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 @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)
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)
```

```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 '@linuxdevil/lousho';
import { createAgent, serveAcp } from '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 '@linuxdevil/lousho';
import { loadAgentDir } from '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 '@linuxdevil/lousho';
import type { AgentHook } from '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 '@linuxdevil/lousho';
import type { ApproveToolCall } from '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 '@linuxdevil/lousho';
import { defineTool } from '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 '@linuxdevil/lousho';
import { createAgent, mountChannels, resolveAgentDir } from '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 '@linuxdevil/lousho';
import { defineMemory, fileMemory, resolveAgentDir } from '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 '@linuxdevil/lousho';
import { fileMemory } from '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 '@linuxdevil/lousho';
import { resolveAgentDir, createAgent } from '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 '@linuxdevil/lousho';
import { mockModel } from '@linuxdevil/lousho/testing';
import { loadAgentDir } from 'lousho';
import { mockModel } from '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 @linuxdevil/lousho dev ./my-agent
npx 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 @linuxdevil/lousho build ./my-agent --target=node-server # or docker
npx 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
32 changes: 16 additions & 16 deletions agent-forge.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: "Lousho Studio is a local web app for building, testing and watchin
---
{/* Generated from docs/agent-forge.md in LinuxDevil/lousho by scripts/sync-sdk-docs.mjs. Do not edit here. */}

It is a separate npm package, `@linuxdevil/studio` — the SDK (`@linuxdevil/lousho`)
It is a separate npm package, `lousho-studio` — the SDK (`lousho`)
does not contain it. One Studio server shows every agent you have: the spec-v2
graph agents saved in your project folders, code agents Studio finds by scanning
a workspace, and agents running anywhere that report to the observe collector.
Expand All @@ -23,15 +23,15 @@ publishing](/forge-lifecycle).
Any of these works:

```bash
npx @linuxdevil/studio
npx lousho-studio
```

```bash
npm i -g @linuxdevil/studio
npm i -g lousho-studio
lousho-studio
```

Or, inside a project that already has `@linuxdevil/lousho` installed, the SDK's
Or, inside a project that already has `lousho` installed, the SDK's
launcher finds the installed Studio and opens this folder as a workspace:

```bash
Expand All @@ -41,14 +41,14 @@ lousho studio
When no Studio is installed the launcher says so instead of bundling one:

```
Studio is a separate install: npx @linuxdevil/studio
Studio is a separate install: npx lousho-studio
```

`lousho studio` accepts `--port` and `--host` and passes them through; run
`lousho studio --help` for its options. `--prod` and `--dev` only apply inside
the SDK's own repository checkout (see [Dev mode](#dev-mode)).

`lousho-studio` (and `npx @linuxdevil/studio`) take the same flags:
`lousho-studio` (and `npx lousho-studio`) take the same flags:

| Flag | Default | Meaning |
| --- | --- | --- |
Expand Down Expand Up @@ -122,7 +122,7 @@ The rest are grouped under **Elsewhere**.
For each workspace Studio picks how agent processes run:

- **Bridge** — the normal case. Studio spawns `lousho bridge` from the SDK
installed in that project (`@linuxdevil/lousho`), so runs use the project's
installed in that project (`lousho`), so runs use the project's
own SDK version. This matters because a project's `{ file }` tools and
skills import that project's dependencies, which only resolve inside the
project.
Expand All @@ -135,10 +135,10 @@ Each non-default state shows a banner at the top of the workspace's pages:

| Banner | What to do |
| --- | --- |
| `This project has no @linuxdevil/lousho installed. Runs use Studio's built-in SDK <version>.` | Runs still work on Studio's SDK. Install `@linuxdevil/lousho` in the project to run its own version. |
| `This project has no lousho installed. Runs use Studio's built-in SDK <version>.` | Runs still work on Studio's SDK. Install `lousho` in the project to run its own version. |
| `This SDK checkout is not built, so runs use Studio's built-in SDK <version>. Run npm run build to use it.` | Inside the SDK repository: run `npm run build` in the checkout. |
| `Update @linuxdevil/lousho in this project to <minimum> or later to edit agents here.` | The project's SDK is older than this Studio understands. The workspace is read-only: update `@linuxdevil/lousho` in the project to edit. |
| `This project's @linuxdevil/lousho <version> is newer than this Studio understands. Update Studio to edit agents here.` | The project has a newer SDK than this Studio was built for. Update Studio (`npm i -g @linuxdevil/studio@latest`) to edit. |
| `Update lousho in this project to <minimum> or later to edit agents here.` | The project's SDK is older than this Studio understands. The workspace is read-only: update `lousho` in the project to edit. |
| `This project's lousho <version> is newer than this Studio understands. Update Studio to edit agents here.` | The project has a newer SDK than this Studio was built for. Update Studio (`npm i -g lousho-studio@latest`) to edit. |
| `This project's agent process keeps stopping. Check the Studio terminal for its output, then restart it.` | The bridge process crashed repeatedly. Its output is in the terminal that started Studio; use **Restart** on the banner to try again. |

While a workspace is read-only, writes under its agents (saves, drafts, runs,
Expand Down Expand Up @@ -181,7 +181,7 @@ shows up in Studio once it reports to a collector Studio can read. Reporting
is pure SDK configuration; nothing in the agent is Studio-specific:

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

// LOUSHO_OBSERVE, LOUSHO_OBSERVE_TOKEN and LOUSHO_OBSERVE_PROJECT are read
// from the environment - no Studio-specific code.
Expand All @@ -203,12 +203,12 @@ screens.

## Updating

Studio (`@linuxdevil/studio`) and the SDK (`@linuxdevil/lousho`) are separate
Studio (`lousho-studio`) and the SDK (`lousho`) are separate
packages and update independently:

```bash
npm i -g @linuxdevil/studio@latest # Studio itself
npm i @linuxdevil/lousho@latest # inside each project, its SDK
npm i -g lousho-studio@latest # Studio itself
npm i lousho@latest # inside each project, its SDK
```

A workspace's agents edit only when the project's SDK is at least
Expand Down Expand Up @@ -270,7 +270,7 @@ skipped with a warning in the server log.

### Production vs. dev mode

An installed Studio (`lousho-studio`, `npx @linuxdevil/studio`, or
An installed Studio (`lousho-studio`, `npx lousho-studio`, or
`lousho studio` finding it) is always production mode: a single Express
server serves both the REST/WebSocket API *and* the pre-built client (React
app) as static files, on one port. There is no separate Vite dev server and
Expand Down Expand Up @@ -755,7 +755,7 @@ and deploy cards; see [Settings, secrets and deploy wiring](#settings-secrets-an
`.lousho/agents/<agent id>/traces/<day>/<trace id>.jsonl` under the
workspace folder (see
[Local traces](/observability#local-traces)):
`npx @linuxdevil/lousho traces --dir .lousho/agents/<agent id>/traces` shows the same
`npx lousho traces --dir .lousho/agents/<agent id>/traces` shows the same
runs in the terminal, and deleting the agent's folder deletes its traces.
The tab shows what the spans hold: model and tool names, token counts,
cost, durations and error messages, and in the inspector's Input,
Expand Down
14 changes: 7 additions & 7 deletions agent-spec.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ A minimal spec is four fields. This snippet parses one and runs it on the
built-in `mock` provider, so it works offline with no API key:

```ts
import { createMockProvider, LLMProviderRegistry, specV2ToAgent } from '@linuxdevil/lousho';
import { parseAgentSpecV2 } from '@linuxdevil/lousho/spec';
import { createMockProvider, LLMProviderRegistry, specV2ToAgent } from 'lousho';
import { parseAgentSpecV2 } from 'lousho/spec';

// 'mock' is a registered provider name; scripting its reply keeps the output deterministic.
LLMProviderRegistry.register('mock', () => createMockProvider({ responses: ['Hello!'] }));
Expand Down Expand Up @@ -278,8 +278,8 @@ for when you want to build the agent yourself. v1's `specToAgent()` stays
separate: it is synchronous and takes a v1 spec, not v2 data.

```ts
import { compileSpec, specV2ToAgent, type SpecHost } from '@linuxdevil/lousho';
import { parseAgentSpecV2 } from '@linuxdevil/lousho/spec';
import { compileSpec, specV2ToAgent, type SpecHost } from 'lousho';
import { parseAgentSpecV2 } from 'lousho/spec';

const host: SpecHost = { baseDir: process.cwd() };
const spec = parseAgentSpecV2({ version: 2, name: 'Greeter', model: 'mock/greeter', instructions: 'Say hello.' });
Expand Down Expand Up @@ -307,14 +307,14 @@ and v1's `agentSpecSchema`. Node-only helpers (`specV2ToAgent`,
stay on the package root.

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

const schema = agentSpecV2JsonSchema(); // the draft-07 JSON Schema of a spec, for forms and editors
console.log(schema.title); // 'AgentSpec v2'
```

```ts
import { parseAgentSpecV2, specToCode } from '@linuxdevil/lousho/spec';
import { parseAgentSpecV2, specToCode } from 'lousho/spec';

const spec = parseAgentSpecV2({ version: 2, name: 'Greeter', model: 'mock/greeter', instructions: 'Say hello.' });
console.log(specToCode(spec)); // the same spec as a readable createAgent({...}) module
Expand All @@ -329,7 +329,7 @@ is not re-validated - run it through `parseAgentSpecV2()` or use
version and always returns a validated `AgentSpecV2`.

```ts
import { loadSpecV2, upgradeSpec } from '@linuxdevil/lousho';
import { loadSpecV2, upgradeSpec } from 'lousho';

const v1 = {
name: 'support-bot',
Expand Down
4 changes: 2 additions & 2 deletions ai-sdk-ui.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The `vendor/` model prefix chooses the provider; with OpenRouter use
`openrouter/<vendor>/<model>` (e.g. `openrouter/openai/gpt-4o-mini`).

```ts
import { createAgent, fromUIMessages, memoryStore, toUIMessageStreamResponse, type UIMessageLike } from '@linuxdevil/lousho';
import { createAgent, fromUIMessages, memoryStore, toUIMessageStreamResponse, type UIMessageLike } from 'lousho';

// The store must outlive the request: without one, every `agent.session({ id })`
// gets a fresh in-memory transcript and the next turn would start empty.
Expand Down Expand Up @@ -159,5 +159,5 @@ kept: a `system` message (or any other role, or an entry that is not a message)
is dropped, so a caller cannot add instructions to the agent's prompt. Set
instructions on the agent (`createAgent({ instructions })`), not in the request.

A dedicated `@linuxdevil/lousho/ai-sdk-ui` subpath may follow; for now the
A dedicated `lousho/ai-sdk-ui` subpath may follow; for now the
functions come from the package root.
Loading
Loading