@neocode-ai/web 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/astro.config.mjs +145 -0
- package/config.mjs +14 -0
- package/package.json +41 -0
- package/public/robots.txt +6 -0
- package/public/theme.json +183 -0
- package/src/assets/lander/check.svg +2 -0
- package/src/assets/lander/copy.svg +2 -0
- package/src/assets/lander/screenshot-github.png +0 -0
- package/src/assets/lander/screenshot-splash.png +0 -0
- package/src/assets/lander/screenshot-vscode.png +0 -0
- package/src/assets/lander/screenshot.png +0 -0
- package/src/assets/logo-dark.svg +20 -0
- package/src/assets/logo-light.svg +20 -0
- package/src/assets/logo-ornate-dark.svg +18 -0
- package/src/assets/logo-ornate-light.svg +18 -0
- package/src/assets/web/web-homepage-active-session.png +0 -0
- package/src/assets/web/web-homepage-new-session.png +0 -0
- package/src/assets/web/web-homepage-see-servers.png +0 -0
- package/src/components/Head.astro +50 -0
- package/src/components/Header.astro +128 -0
- package/src/components/Hero.astro +11 -0
- package/src/components/Lander.astro +713 -0
- package/src/components/Share.tsx +634 -0
- package/src/components/SiteTitle.astro +59 -0
- package/src/components/icons/custom.tsx +87 -0
- package/src/components/icons/index.tsx +4454 -0
- package/src/components/share/common.tsx +77 -0
- package/src/components/share/content-bash.module.css +85 -0
- package/src/components/share/content-bash.tsx +67 -0
- package/src/components/share/content-code.module.css +26 -0
- package/src/components/share/content-code.tsx +32 -0
- package/src/components/share/content-diff.module.css +153 -0
- package/src/components/share/content-diff.tsx +231 -0
- package/src/components/share/content-error.module.css +64 -0
- package/src/components/share/content-error.tsx +24 -0
- package/src/components/share/content-markdown.module.css +154 -0
- package/src/components/share/content-markdown.tsx +75 -0
- package/src/components/share/content-text.module.css +63 -0
- package/src/components/share/content-text.tsx +37 -0
- package/src/components/share/copy-button.module.css +30 -0
- package/src/components/share/copy-button.tsx +28 -0
- package/src/components/share/part.module.css +428 -0
- package/src/components/share/part.tsx +780 -0
- package/src/components/share.module.css +832 -0
- package/src/content/docs/1-0.mdx +67 -0
- package/src/content/docs/acp.mdx +156 -0
- package/src/content/docs/agents.mdx +720 -0
- package/src/content/docs/cli.mdx +597 -0
- package/src/content/docs/commands.mdx +323 -0
- package/src/content/docs/config.mdx +683 -0
- package/src/content/docs/custom-tools.mdx +170 -0
- package/src/content/docs/ecosystem.mdx +76 -0
- package/src/content/docs/enterprise.mdx +170 -0
- package/src/content/docs/formatters.mdx +130 -0
- package/src/content/docs/github.mdx +321 -0
- package/src/content/docs/gitlab.mdx +195 -0
- package/src/content/docs/ide.mdx +48 -0
- package/src/content/docs/index.mdx +359 -0
- package/src/content/docs/keybinds.mdx +191 -0
- package/src/content/docs/lsp.mdx +188 -0
- package/src/content/docs/mcp-servers.mdx +511 -0
- package/src/content/docs/models.mdx +223 -0
- package/src/content/docs/modes.mdx +331 -0
- package/src/content/docs/network.mdx +57 -0
- package/src/content/docs/permissions.mdx +237 -0
- package/src/content/docs/plugins.mdx +362 -0
- package/src/content/docs/providers.mdx +1889 -0
- package/src/content/docs/rules.mdx +180 -0
- package/src/content/docs/sdk.mdx +391 -0
- package/src/content/docs/server.mdx +286 -0
- package/src/content/docs/share.mdx +128 -0
- package/src/content/docs/skills.mdx +220 -0
- package/src/content/docs/themes.mdx +369 -0
- package/src/content/docs/tools.mdx +345 -0
- package/src/content/docs/troubleshooting.mdx +300 -0
- package/src/content/docs/tui.mdx +390 -0
- package/src/content/docs/web.mdx +136 -0
- package/src/content/docs/windows-wsl.mdx +113 -0
- package/src/content/docs/zen.mdx +251 -0
- package/src/content.config.ts +7 -0
- package/src/pages/[...slug].md.ts +18 -0
- package/src/pages/s/[id].astro +113 -0
- package/src/styles/custom.css +405 -0
- package/src/types/lang-map.d.ts +27 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Rules
|
|
3
|
+
description: Set custom instructions for neocode.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You can provide custom instructions to neocode by creating an `AGENTS.md` file. This is similar to Cursor's rules. It contains instructions that will be included in the LLM's context to customize its behavior for your specific project.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Initialize
|
|
11
|
+
|
|
12
|
+
To create a new `AGENTS.md` file, you can run the `/init` command in neocode.
|
|
13
|
+
|
|
14
|
+
:::tip
|
|
15
|
+
You should commit your project's `AGENTS.md` file to Git.
|
|
16
|
+
:::
|
|
17
|
+
|
|
18
|
+
This will scan your project and all its contents to understand what the project is about and generate an `AGENTS.md` file with it. This helps neocode to navigate the project better.
|
|
19
|
+
|
|
20
|
+
If you have an existing `AGENTS.md` file, this will try to add to it.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Example
|
|
25
|
+
|
|
26
|
+
You can also just create this file manually. Here's an example of some things you can put into an `AGENTS.md` file.
|
|
27
|
+
|
|
28
|
+
```markdown title="AGENTS.md"
|
|
29
|
+
# SST v3 Monorepo Project
|
|
30
|
+
|
|
31
|
+
This is an SST v3 monorepo with TypeScript. The project uses bun workspaces for package management.
|
|
32
|
+
|
|
33
|
+
## Project Structure
|
|
34
|
+
|
|
35
|
+
- `packages/` - Contains all workspace packages (functions, core, web, etc.)
|
|
36
|
+
- `infra/` - Infrastructure definitions split by service (storage.ts, api.ts, web.ts)
|
|
37
|
+
- `sst.config.ts` - Main SST configuration with dynamic imports
|
|
38
|
+
|
|
39
|
+
## Code Standards
|
|
40
|
+
|
|
41
|
+
- Use TypeScript with strict mode enabled
|
|
42
|
+
- Shared code goes in `packages/core/` with proper exports configuration
|
|
43
|
+
- Functions go in `packages/functions/`
|
|
44
|
+
- Infrastructure should be split into logical files in `infra/`
|
|
45
|
+
|
|
46
|
+
## Monorepo Conventions
|
|
47
|
+
|
|
48
|
+
- Import shared modules using workspace names: `@my-app/core/example`
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
We are adding project-specific instructions here and this will be shared across your team.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Types
|
|
56
|
+
|
|
57
|
+
neocode also supports reading the `AGENTS.md` file from multiple locations. And this serves different purposes.
|
|
58
|
+
|
|
59
|
+
### Project
|
|
60
|
+
|
|
61
|
+
Place an `AGENTS.md` in your project root for project-specific rules. These only apply when you are working in this directory or its sub-directories.
|
|
62
|
+
|
|
63
|
+
### Global
|
|
64
|
+
|
|
65
|
+
You can also have global rules in a `~/.config/neocode/AGENTS.md` file. This gets applied across all neocode sessions.
|
|
66
|
+
|
|
67
|
+
Since this isn't committed to Git or shared with your team, we recommend using this to specify any personal rules that the LLM should follow.
|
|
68
|
+
|
|
69
|
+
### Claude Code Compatibility
|
|
70
|
+
|
|
71
|
+
For users migrating from Claude Code, NeoCode supports Claude Code's file conventions as fallbacks:
|
|
72
|
+
|
|
73
|
+
- **Project rules**: `CLAUDE.md` in your project directory (used if no `AGENTS.md` exists)
|
|
74
|
+
- **Global rules**: `~/.claude/CLAUDE.md` (used if no `~/.config/neocode/AGENTS.md` exists)
|
|
75
|
+
- **Skills**: `~/.claude/skills/` — see [Agent Skills](/docs/skills/) for details
|
|
76
|
+
|
|
77
|
+
To disable Claude Code compatibility, set one of these environment variables:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
export NEOCODE_DISABLE_CLAUDE_CODE=1 # Disable all .claude support
|
|
81
|
+
export NEOCODE_DISABLE_CLAUDE_CODE_PROMPT=1 # Disable only ~/.claude/CLAUDE.md
|
|
82
|
+
export NEOCODE_DISABLE_CLAUDE_CODE_SKILLS=1 # Disable only .claude/skills
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Precedence
|
|
88
|
+
|
|
89
|
+
When neocode starts, it looks for rule files in this order:
|
|
90
|
+
|
|
91
|
+
1. **Local files** by traversing up from the current directory (`AGENTS.md`, `CLAUDE.md`)
|
|
92
|
+
2. **Global file** at `~/.config/neocode/AGENTS.md`
|
|
93
|
+
3. **Claude Code file** at `~/.claude/CLAUDE.md` (unless disabled)
|
|
94
|
+
|
|
95
|
+
The first matching file wins in each category. For example, if you have both `AGENTS.md` and `CLAUDE.md`, only `AGENTS.md` is used. Similarly, `~/.config/neocode/AGENTS.md` takes precedence over `~/.claude/CLAUDE.md`.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Custom Instructions
|
|
100
|
+
|
|
101
|
+
You can specify custom instruction files in your `neocode.json` or the global `~/.config/neocode/neocode.json`. This allows you and your team to reuse existing rules rather than having to duplicate them to AGENTS.md.
|
|
102
|
+
|
|
103
|
+
Example:
|
|
104
|
+
|
|
105
|
+
```json title="neocode.json"
|
|
106
|
+
{
|
|
107
|
+
"$schema": "https://neo.khulnasoft.com/config.json",
|
|
108
|
+
"instructions": ["CONTRIBUTING.md", "docs/guidelines.md", ".cursor/rules/*.md"]
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
You can also use remote URLs to load instructions from the web.
|
|
113
|
+
|
|
114
|
+
```json title="neocode.json"
|
|
115
|
+
{
|
|
116
|
+
"$schema": "https://neo.khulnasoft.com/config.json",
|
|
117
|
+
"instructions": ["https://raw.githubusercontent.com/my-org/shared-rules/main/style.md"]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Remote instructions are fetched with a 5 second timeout.
|
|
122
|
+
|
|
123
|
+
All instruction files are combined with your `AGENTS.md` files.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Referencing External Files
|
|
128
|
+
|
|
129
|
+
While neocode doesn't automatically parse file references in `AGENTS.md`, you can achieve similar functionality in two ways:
|
|
130
|
+
|
|
131
|
+
### Using neocode.json
|
|
132
|
+
|
|
133
|
+
The recommended approach is to use the `instructions` field in `neocode.json`:
|
|
134
|
+
|
|
135
|
+
```json title="neocode.json"
|
|
136
|
+
{
|
|
137
|
+
"$schema": "https://neo.khulnasoft.com/config.json",
|
|
138
|
+
"instructions": ["docs/development-standards.md", "test/testing-guidelines.md", "packages/*/AGENTS.md"]
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Manual Instructions in AGENTS.md
|
|
143
|
+
|
|
144
|
+
You can teach neocode to read external files by providing explicit instructions in your `AGENTS.md`. Here's a practical example:
|
|
145
|
+
|
|
146
|
+
```markdown title="AGENTS.md"
|
|
147
|
+
# TypeScript Project Rules
|
|
148
|
+
|
|
149
|
+
## External File Loading
|
|
150
|
+
|
|
151
|
+
CRITICAL: When you encounter a file reference (e.g., @rules/general.md), use your Read tool to load it on a need-to-know basis. They're relevant to the SPECIFIC task at hand.
|
|
152
|
+
|
|
153
|
+
Instructions:
|
|
154
|
+
|
|
155
|
+
- Do NOT preemptively load all references - use lazy loading based on actual need
|
|
156
|
+
- When loaded, treat content as mandatory instructions that override defaults
|
|
157
|
+
- Follow references recursively when needed
|
|
158
|
+
|
|
159
|
+
## Development Guidelines
|
|
160
|
+
|
|
161
|
+
For TypeScript code style and best practices: @docs/typescript-guidelines.md
|
|
162
|
+
For React component architecture and hooks patterns: @docs/react-patterns.md
|
|
163
|
+
For REST API design and error handling: @docs/api-standards.md
|
|
164
|
+
For testing strategies and coverage requirements: @test/testing-guidelines.md
|
|
165
|
+
|
|
166
|
+
## General Guidelines
|
|
167
|
+
|
|
168
|
+
Read the following file immediately as it's relevant to all workflows: @rules/general-guidelines.md.
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
This approach allows you to:
|
|
172
|
+
|
|
173
|
+
- Create modular, reusable rule files
|
|
174
|
+
- Share rules across projects via symlinks or git submodules
|
|
175
|
+
- Keep AGENTS.md concise while referencing detailed guidelines
|
|
176
|
+
- Ensure neocode loads files only when needed for the specific task
|
|
177
|
+
|
|
178
|
+
:::tip
|
|
179
|
+
For monorepos or projects with shared standards, using `neocode.json` with glob patterns (like `packages/*/AGENTS.md`) is more maintainable than manual instructions.
|
|
180
|
+
:::
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SDK
|
|
3
|
+
description: Type-safe JS client for neocode server.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import config from "../../../config.mjs"
|
|
7
|
+
export const typesUrl = `${config.github}/blob/dev/packages/sdk/js/src/gen/types.gen.ts`
|
|
8
|
+
|
|
9
|
+
The neocode JS/TS SDK provides a type-safe client for interacting with the server.
|
|
10
|
+
Use it to build integrations and control neocode programmatically.
|
|
11
|
+
|
|
12
|
+
[Learn more](/docs/server) about how the server works. For examples, check out the [projects](/docs/ecosystem#projects) built by the community.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Install the SDK from npm:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @neocode-ai/sdk
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Create client
|
|
27
|
+
|
|
28
|
+
Create an instance of neocode:
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
import { createNeocode } from "@neocode-ai/sdk"
|
|
32
|
+
|
|
33
|
+
const { client } = await createNeocode()
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This starts both a server and a client
|
|
37
|
+
|
|
38
|
+
#### Options
|
|
39
|
+
|
|
40
|
+
| Option | Type | Description | Default |
|
|
41
|
+
| ---------- | ------------- | ------------------------------ | ----------- |
|
|
42
|
+
| `hostname` | `string` | Server hostname | `127.0.0.1` |
|
|
43
|
+
| `port` | `number` | Server port | `4096` |
|
|
44
|
+
| `signal` | `AbortSignal` | Abort signal for cancellation | `undefined` |
|
|
45
|
+
| `timeout` | `number` | Timeout in ms for server start | `5000` |
|
|
46
|
+
| `config` | `Config` | Configuration object | `{}` |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Config
|
|
51
|
+
|
|
52
|
+
You can pass a configuration object to customize behavior. The instance still picks up your `neocode.json`, but you can override or add configuration inline:
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
import { createNeocode } from "@neocode-ai/sdk"
|
|
56
|
+
|
|
57
|
+
const neocode = await createNeocode({
|
|
58
|
+
hostname: "127.0.0.1",
|
|
59
|
+
port: 4096,
|
|
60
|
+
config: {
|
|
61
|
+
model: "anthropic/claude-3-5-sonnet-20241022",
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
console.log(`Server running at ${neocode.server.url}`)
|
|
66
|
+
|
|
67
|
+
neocode.server.close()
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Client only
|
|
71
|
+
|
|
72
|
+
If you already have a running instance of neocode, you can create a client instance to connect to it:
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
import { createNeocodeClient } from "@neocode-ai/sdk"
|
|
76
|
+
|
|
77
|
+
const client = createNeocodeClient({
|
|
78
|
+
baseUrl: "http://localhost:4096",
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Options
|
|
83
|
+
|
|
84
|
+
| Option | Type | Description | Default |
|
|
85
|
+
| --------------- | ---------- | -------------------------------- | ----------------------- |
|
|
86
|
+
| `baseUrl` | `string` | URL of the server | `http://localhost:4096` |
|
|
87
|
+
| `fetch` | `function` | Custom fetch implementation | `globalThis.fetch` |
|
|
88
|
+
| `parseAs` | `string` | Response parsing method | `auto` |
|
|
89
|
+
| `responseStyle` | `string` | Return style: `data` or `fields` | `fields` |
|
|
90
|
+
| `throwOnError` | `boolean` | Throw errors instead of return | `false` |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Types
|
|
95
|
+
|
|
96
|
+
The SDK includes TypeScript definitions for all API types. Import them directly:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import type { Session, Message, Part } from "@neocode-ai/sdk"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
All types are generated from the server's OpenAPI specification and available in the <a href={typesUrl}>types file</a>.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Errors
|
|
107
|
+
|
|
108
|
+
The SDK can throw errors that you can catch and handle:
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
try {
|
|
112
|
+
await client.session.get({ path: { id: "invalid-id" } })
|
|
113
|
+
} catch (error) {
|
|
114
|
+
console.error("Failed to get session:", (error as Error).message)
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## APIs
|
|
121
|
+
|
|
122
|
+
The SDK exposes all server APIs through a type-safe client.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### Global
|
|
127
|
+
|
|
128
|
+
| Method | Description | Response |
|
|
129
|
+
| ----------------- | ------------------------------- | ------------------------------------ |
|
|
130
|
+
| `global.health()` | Check server health and version | `{ healthy: true, version: string }` |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
#### Examples
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
const health = await client.global.health()
|
|
138
|
+
console.log(health.data.version)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
### App
|
|
144
|
+
|
|
145
|
+
| Method | Description | Response |
|
|
146
|
+
| -------------- | ------------------------- | ------------------------------------------- |
|
|
147
|
+
| `app.log()` | Write a log entry | `boolean` |
|
|
148
|
+
| `app.agents()` | List all available agents | <a href={typesUrl}><code>Agent[]</code></a> |
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
#### Examples
|
|
153
|
+
|
|
154
|
+
```javascript
|
|
155
|
+
// Write a log entry
|
|
156
|
+
await client.app.log({
|
|
157
|
+
body: {
|
|
158
|
+
service: "my-app",
|
|
159
|
+
level: "info",
|
|
160
|
+
message: "Operation completed",
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
// List available agents
|
|
165
|
+
const agents = await client.app.agents()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### Project
|
|
171
|
+
|
|
172
|
+
| Method | Description | Response |
|
|
173
|
+
| ------------------- | ------------------- | --------------------------------------------- |
|
|
174
|
+
| `project.list()` | List all projects | <a href={typesUrl}><code>Project[]</code></a> |
|
|
175
|
+
| `project.current()` | Get current project | <a href={typesUrl}><code>Project</code></a> |
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
#### Examples
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
// List all projects
|
|
183
|
+
const projects = await client.project.list()
|
|
184
|
+
|
|
185
|
+
// Get current project
|
|
186
|
+
const currentProject = await client.project.current()
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
### Path
|
|
192
|
+
|
|
193
|
+
| Method | Description | Response |
|
|
194
|
+
| ------------ | ---------------- | ---------------------------------------- |
|
|
195
|
+
| `path.get()` | Get current path | <a href={typesUrl}><code>Path</code></a> |
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
#### Examples
|
|
200
|
+
|
|
201
|
+
```javascript
|
|
202
|
+
// Get current path information
|
|
203
|
+
const pathInfo = await client.path.get()
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### Config
|
|
209
|
+
|
|
210
|
+
| Method | Description | Response |
|
|
211
|
+
| -------------------- | --------------------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
212
|
+
| `config.get()` | Get config info | <a href={typesUrl}><code>Config</code></a> |
|
|
213
|
+
| `config.providers()` | List providers and default models | `{ providers: `<a href={typesUrl}><code>Provider[]</code></a>`, default: { [key: string]: string } }` |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
#### Examples
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
const config = await client.config.get()
|
|
221
|
+
|
|
222
|
+
const { providers, default: defaults } = await client.config.providers()
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
### Sessions
|
|
228
|
+
|
|
229
|
+
| Method | Description | Notes |
|
|
230
|
+
| ---------------------------------------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
231
|
+
| `session.list()` | List sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
|
|
232
|
+
| `session.get({ path })` | Get session | Returns <a href={typesUrl}><code>Session</code></a> |
|
|
233
|
+
| `session.children({ path })` | List child sessions | Returns <a href={typesUrl}><code>Session[]</code></a> |
|
|
234
|
+
| `session.create({ body })` | Create session | Returns <a href={typesUrl}><code>Session</code></a> |
|
|
235
|
+
| `session.delete({ path })` | Delete session | Returns `boolean` |
|
|
236
|
+
| `session.update({ path, body })` | Update session properties | Returns <a href={typesUrl}><code>Session</code></a> |
|
|
237
|
+
| `session.init({ path, body })` | Analyze app and create `AGENTS.md` | Returns `boolean` |
|
|
238
|
+
| `session.abort({ path })` | Abort a running session | Returns `boolean` |
|
|
239
|
+
| `session.share({ path })` | Share session | Returns <a href={typesUrl}><code>Session</code></a> |
|
|
240
|
+
| `session.unshare({ path })` | Unshare session | Returns <a href={typesUrl}><code>Session</code></a> |
|
|
241
|
+
| `session.summarize({ path, body })` | Summarize session | Returns `boolean` |
|
|
242
|
+
| `session.messages({ path })` | List messages in a session | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}[]` |
|
|
243
|
+
| `session.message({ path })` | Get message details | Returns `{ info: `<a href={typesUrl}><code>Message</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
|
|
244
|
+
| `session.prompt({ path, body })` | Send prompt message | `body.noReply: true` returns UserMessage (context only). Default returns <a href={typesUrl}><code>AssistantMessage</code></a> with AI response |
|
|
245
|
+
| `session.command({ path, body })` | Send command to session | Returns `{ info: `<a href={typesUrl}><code>AssistantMessage</code></a>`, parts: `<a href={typesUrl}><code>Part[]</code></a>`}` |
|
|
246
|
+
| `session.shell({ path, body })` | Run a shell command | Returns <a href={typesUrl}><code>AssistantMessage</code></a> |
|
|
247
|
+
| `session.revert({ path, body })` | Revert a message | Returns <a href={typesUrl}><code>Session</code></a> |
|
|
248
|
+
| `session.unrevert({ path })` | Restore reverted messages | Returns <a href={typesUrl}><code>Session</code></a> |
|
|
249
|
+
| `postSessionByIdPermissionsByPermissionId({ path, body })` | Respond to a permission request | Returns `boolean` |
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
#### Examples
|
|
254
|
+
|
|
255
|
+
```javascript
|
|
256
|
+
// Create and manage sessions
|
|
257
|
+
const session = await client.session.create({
|
|
258
|
+
body: { title: "My session" },
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
const sessions = await client.session.list()
|
|
262
|
+
|
|
263
|
+
// Send a prompt message
|
|
264
|
+
const result = await client.session.prompt({
|
|
265
|
+
path: { id: session.id },
|
|
266
|
+
body: {
|
|
267
|
+
model: { providerID: "anthropic", modelID: "claude-3-5-sonnet-20241022" },
|
|
268
|
+
parts: [{ type: "text", text: "Hello!" }],
|
|
269
|
+
},
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
// Inject context without triggering AI response (useful for plugins)
|
|
273
|
+
await client.session.prompt({
|
|
274
|
+
path: { id: session.id },
|
|
275
|
+
body: {
|
|
276
|
+
noReply: true,
|
|
277
|
+
parts: [{ type: "text", text: "You are a helpful assistant." }],
|
|
278
|
+
},
|
|
279
|
+
})
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### Files
|
|
285
|
+
|
|
286
|
+
| Method | Description | Response |
|
|
287
|
+
| ------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
288
|
+
| `find.text({ query })` | Search for text in files | Array of match objects with `path`, `lines`, `line_number`, `absolute_offset`, `submatches` |
|
|
289
|
+
| `find.files({ query })` | Find files and directories by name | `string[]` (paths) |
|
|
290
|
+
| `find.symbols({ query })` | Find workspace symbols | <a href={typesUrl}><code>Symbol[]</code></a> |
|
|
291
|
+
| `file.read({ query })` | Read a file | `{ type: "raw" \| "patch", content: string }` |
|
|
292
|
+
| `file.status({ query? })` | Get status for tracked files | <a href={typesUrl}><code>File[]</code></a> |
|
|
293
|
+
|
|
294
|
+
`find.files` supports a few optional query fields:
|
|
295
|
+
|
|
296
|
+
- `type`: `"file"` or `"directory"`
|
|
297
|
+
- `directory`: override the project root for the search
|
|
298
|
+
- `limit`: max results (1–200)
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
#### Examples
|
|
303
|
+
|
|
304
|
+
```javascript
|
|
305
|
+
// Search and read files
|
|
306
|
+
const textResults = await client.find.text({
|
|
307
|
+
query: { pattern: "function.*neocode" },
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
const files = await client.find.files({
|
|
311
|
+
query: { query: "*.ts", type: "file" },
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
const directories = await client.find.files({
|
|
315
|
+
query: { query: "packages", type: "directory", limit: 20 },
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
const content = await client.file.read({
|
|
319
|
+
query: { path: "src/index.ts" },
|
|
320
|
+
})
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
### TUI
|
|
326
|
+
|
|
327
|
+
| Method | Description | Response |
|
|
328
|
+
| ------------------------------ | ------------------------- | --------- |
|
|
329
|
+
| `tui.appendPrompt({ body })` | Append text to the prompt | `boolean` |
|
|
330
|
+
| `tui.openHelp()` | Open the help dialog | `boolean` |
|
|
331
|
+
| `tui.openSessions()` | Open the session selector | `boolean` |
|
|
332
|
+
| `tui.openThemes()` | Open the theme selector | `boolean` |
|
|
333
|
+
| `tui.openModels()` | Open the model selector | `boolean` |
|
|
334
|
+
| `tui.submitPrompt()` | Submit the current prompt | `boolean` |
|
|
335
|
+
| `tui.clearPrompt()` | Clear the prompt | `boolean` |
|
|
336
|
+
| `tui.executeCommand({ body })` | Execute a command | `boolean` |
|
|
337
|
+
| `tui.showToast({ body })` | Show toast notification | `boolean` |
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
#### Examples
|
|
342
|
+
|
|
343
|
+
```javascript
|
|
344
|
+
// Control TUI interface
|
|
345
|
+
await client.tui.appendPrompt({
|
|
346
|
+
body: { text: "Add this to prompt" },
|
|
347
|
+
})
|
|
348
|
+
|
|
349
|
+
await client.tui.showToast({
|
|
350
|
+
body: { message: "Task completed", variant: "success" },
|
|
351
|
+
})
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
### Auth
|
|
357
|
+
|
|
358
|
+
| Method | Description | Response |
|
|
359
|
+
| ------------------- | ------------------------------ | --------- |
|
|
360
|
+
| `auth.set({ ... })` | Set authentication credentials | `boolean` |
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
#### Examples
|
|
365
|
+
|
|
366
|
+
```javascript
|
|
367
|
+
await client.auth.set({
|
|
368
|
+
path: { id: "anthropic" },
|
|
369
|
+
body: { type: "api", key: "your-api-key" },
|
|
370
|
+
})
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
### Events
|
|
376
|
+
|
|
377
|
+
| Method | Description | Response |
|
|
378
|
+
| ------------------- | ------------------------- | ------------------------- |
|
|
379
|
+
| `event.subscribe()` | Server-sent events stream | Server-sent events stream |
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
#### Examples
|
|
384
|
+
|
|
385
|
+
```javascript
|
|
386
|
+
// Listen to real-time events
|
|
387
|
+
const events = await client.event.subscribe()
|
|
388
|
+
for await (const event of events.stream) {
|
|
389
|
+
console.log("Event:", event.type, event.properties)
|
|
390
|
+
}
|
|
391
|
+
```
|