@oh-my-pi/pi-coding-agent 2.3.1337 → 3.0.1337
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/CHANGELOG.md +62 -34
- package/README.md +100 -100
- package/docs/compaction.md +8 -8
- package/docs/config-usage.md +113 -0
- package/docs/custom-tools.md +8 -8
- package/docs/extension-loading.md +58 -58
- package/docs/hooks.md +11 -11
- package/docs/rpc.md +4 -4
- package/docs/sdk.md +14 -14
- package/docs/session-tree-plan.md +1 -1
- package/docs/session.md +2 -2
- package/docs/skills.md +16 -16
- package/docs/theme.md +9 -9
- package/docs/tui.md +1 -1
- package/examples/README.md +1 -1
- package/examples/custom-tools/README.md +4 -4
- package/examples/custom-tools/subagent/README.md +13 -13
- package/examples/custom-tools/subagent/agents.ts +2 -2
- package/examples/custom-tools/subagent/index.ts +5 -5
- package/examples/hooks/README.md +3 -3
- package/examples/hooks/auto-commit-on-exit.ts +1 -1
- package/examples/hooks/custom-compaction.ts +1 -1
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/05-tools.ts +1 -1
- package/examples/sdk/08-slash-commands.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +2 -2
- package/examples/sdk/README.md +2 -2
- package/package.json +13 -11
- package/src/capability/context-file.ts +40 -0
- package/src/capability/extension.ts +48 -0
- package/src/capability/hook.ts +40 -0
- package/src/capability/index.ts +616 -0
- package/src/capability/instruction.ts +37 -0
- package/src/capability/mcp.ts +52 -0
- package/src/capability/prompt.ts +35 -0
- package/src/capability/rule.ts +52 -0
- package/src/capability/settings.ts +35 -0
- package/src/capability/skill.ts +49 -0
- package/src/capability/slash-command.ts +40 -0
- package/src/capability/system-prompt.ts +35 -0
- package/src/capability/tool.ts +38 -0
- package/src/capability/types.ts +166 -0
- package/src/cli/args.ts +2 -2
- package/src/cli/plugin-cli.ts +24 -19
- package/src/cli/update-cli.ts +10 -10
- package/src/config.ts +290 -6
- package/src/core/auth-storage.ts +32 -9
- package/src/core/bash-executor.ts +1 -1
- package/src/core/custom-commands/loader.ts +44 -50
- package/src/core/custom-tools/index.ts +1 -0
- package/src/core/custom-tools/loader.ts +67 -69
- package/src/core/custom-tools/types.ts +10 -1
- package/src/core/hooks/loader.ts +13 -42
- package/src/core/index.ts +0 -1
- package/src/core/logger.ts +7 -7
- package/src/core/mcp/client.ts +1 -1
- package/src/core/mcp/config.ts +94 -146
- package/src/core/mcp/index.ts +0 -4
- package/src/core/mcp/loader.ts +26 -22
- package/src/core/mcp/manager.ts +18 -23
- package/src/core/mcp/tool-bridge.ts +9 -1
- package/src/core/mcp/types.ts +2 -0
- package/src/core/model-registry.ts +25 -8
- package/src/core/plugins/installer.ts +1 -1
- package/src/core/plugins/loader.ts +17 -11
- package/src/core/plugins/manager.ts +2 -2
- package/src/core/plugins/paths.ts +12 -7
- package/src/core/plugins/types.ts +3 -3
- package/src/core/sdk.ts +48 -27
- package/src/core/session-manager.ts +4 -4
- package/src/core/settings-manager.ts +45 -21
- package/src/core/skills.ts +222 -293
- package/src/core/slash-commands.ts +34 -165
- package/src/core/system-prompt.ts +58 -65
- package/src/core/timings.ts +2 -2
- package/src/core/tools/lsp/config.ts +38 -17
- package/src/core/tools/task/artifacts.ts +1 -1
- package/src/core/tools/task/commands.ts +30 -107
- package/src/core/tools/task/discovery.ts +54 -66
- package/src/core/tools/task/executor.ts +9 -9
- package/src/core/tools/task/index.ts +10 -10
- package/src/core/tools/task/model-resolver.ts +27 -25
- package/src/core/tools/task/types.ts +2 -2
- package/src/core/tools/web-fetch.ts +3 -3
- package/src/core/tools/web-search/auth.ts +40 -34
- package/src/core/tools/web-search/index.ts +1 -1
- package/src/core/tools/web-search/providers/anthropic.ts +1 -1
- package/src/discovery/agents-md.ts +75 -0
- package/src/discovery/builtin.ts +646 -0
- package/src/discovery/claude.ts +623 -0
- package/src/discovery/cline.ts +102 -0
- package/src/discovery/codex.ts +571 -0
- package/src/discovery/cursor.ts +264 -0
- package/src/discovery/gemini.ts +368 -0
- package/src/discovery/github.ts +120 -0
- package/src/discovery/helpers.test.ts +127 -0
- package/src/discovery/helpers.ts +249 -0
- package/src/discovery/index.ts +84 -0
- package/src/discovery/mcp-json.ts +127 -0
- package/src/discovery/vscode.ts +99 -0
- package/src/discovery/windsurf.ts +216 -0
- package/src/main.ts +14 -13
- package/src/migrations.ts +24 -3
- package/src/modes/interactive/components/hook-editor.ts +1 -1
- package/src/modes/interactive/components/plugin-settings.ts +1 -1
- package/src/modes/interactive/components/settings-defs.ts +38 -2
- package/src/modes/interactive/components/settings-selector.ts +1 -0
- package/src/modes/interactive/components/welcome.ts +2 -2
- package/src/modes/interactive/interactive-mode.ts +211 -16
- package/src/modes/interactive/theme/theme-schema.json +1 -1
- package/src/utils/clipboard.ts +1 -1
- package/src/utils/shell-snapshot.ts +2 -2
- package/src/utils/shell.ts +7 -7
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Config Module Usage Map
|
|
2
|
+
|
|
3
|
+
This document shows how each file uses the config module and what subpaths they access.
|
|
4
|
+
|
|
5
|
+
## Overview Diagram
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌─────────────────────────────────────────────────────────────────────────────────┐
|
|
9
|
+
│ config.ts exports │
|
|
10
|
+
├─────────────────────────────────────────────────────────────────────────────────┤
|
|
11
|
+
│ Constants: APP_NAME, CONFIG_DIR_NAME, VERSION, ENV_AGENT_DIR │
|
|
12
|
+
│ Single paths: getAgentDir, getAuthPath, getModelsPath, getCommandsDir, ... │
|
|
13
|
+
│ Multi-config: getConfigDirs, getConfigDirPaths, findConfigFile, │
|
|
14
|
+
│ readConfigFile, findNearestProjectConfigDir, ... │
|
|
15
|
+
└─────────────────────────────────────────────────────────────────────────────────┘
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage by Category
|
|
19
|
+
|
|
20
|
+
### 1. Display/Branding Only (no file I/O)
|
|
21
|
+
|
|
22
|
+
| File | Imports | Purpose |
|
|
23
|
+
|------|---------|---------|
|
|
24
|
+
| `cli/args.ts` | `APP_NAME`, `CONFIG_DIR_NAME`, `ENV_AGENT_DIR` | Help text, env var names |
|
|
25
|
+
| `cli/plugin-cli.ts` | `APP_NAME` | Command output |
|
|
26
|
+
| `cli/update-cli.ts` | `APP_NAME`, `VERSION` | Update messages |
|
|
27
|
+
| `core/export-html/index.ts` | `APP_NAME` | HTML export title |
|
|
28
|
+
| `modes/interactive/components/welcome.ts` | `APP_NAME` | Welcome banner |
|
|
29
|
+
| `utils/tools-manager.ts` | `APP_NAME` | Tool download messages |
|
|
30
|
+
|
|
31
|
+
### 2. Single Fixed Paths (user-level only)
|
|
32
|
+
|
|
33
|
+
| File | Imports | Path | Purpose |
|
|
34
|
+
|------|---------|------|---------|
|
|
35
|
+
| `core/logger.ts` | `CONFIG_DIR_NAME` | `~/.omp/logs/` | Log file directory |
|
|
36
|
+
| `core/agent-session.ts` | `getAuthPath` | `~/.omp/agent/auth.json` | Error messages |
|
|
37
|
+
| `core/session-manager.ts` | `getAgentDir` | `~/.omp/agent/sessions/` | Session storage |
|
|
38
|
+
| `modes/interactive/theme/theme.ts` | `getCustomThemesDir` | `~/.omp/agent/themes/` | Custom themes |
|
|
39
|
+
| `modes/interactive/interactive-mode.ts` | `getAuthPath`, `getDebugLogPath` | auth.json, debug log | Status messages |
|
|
40
|
+
| `utils/changelog.ts` | `getChangelogPath` | Package CHANGELOG.md | Re-exports |
|
|
41
|
+
| `core/system-prompt.ts` | `getAgentDir`, `getDocsPath`, `getExamplesPath`, `getReadmePath` | Package assets + AGENTS.md | System prompt building |
|
|
42
|
+
| `migrations.ts` | `getAgentDir` | `~/.omp/agent/` | Auth/session migration |
|
|
43
|
+
| `core/plugins/installer.ts` | `getAgentDir` | `~/.omp/agent/` | Plugin installation |
|
|
44
|
+
| `core/plugins/paths.ts` | `CONFIG_DIR_NAME` | `~/.omp/plugins/` | Plugin directories |
|
|
45
|
+
|
|
46
|
+
### 3. Multi-Config Discovery (with fallbacks)
|
|
47
|
+
|
|
48
|
+
These use the new helpers to check `.omp`, `.pi`, `.claude` directories:
|
|
49
|
+
|
|
50
|
+
| File | Helper Used | Subpath(s) | Levels |
|
|
51
|
+
|------|-------------|------------|--------|
|
|
52
|
+
| `main.ts` | `findConfigFile` | `SYSTEM.md` | project |
|
|
53
|
+
| `core/sdk.ts` | `getConfigDirPaths` | `auth.json`, `models.json` | user |
|
|
54
|
+
| `core/settings-manager.ts` | `readConfigFile` | `settings.json` | user+project |
|
|
55
|
+
| `core/skills.ts` | `getConfigDirPaths` | `skills/` | user+project |
|
|
56
|
+
| `core/slash-commands.ts` | `getConfigDirPaths` | `commands/` | project |
|
|
57
|
+
| `core/hooks/loader.ts` | `getConfigDirPaths` | `hooks/` | project |
|
|
58
|
+
| `core/custom-tools/loader.ts` | `getConfigDirPaths` | `tools/` | project |
|
|
59
|
+
| `core/custom-commands/loader.ts` | `getConfigDirPaths` | `commands/` | project |
|
|
60
|
+
| `core/plugins/paths.ts` | `getConfigDirPaths` | `plugin-overrides.json` | project |
|
|
61
|
+
| `core/mcp/config.ts` | `getConfigDirPaths` | `mcp.json` | user+project |
|
|
62
|
+
| `core/tools/lsp/config.ts` | `getConfigDirPaths` | `lsp.json`, `.lsp.json` | user+project |
|
|
63
|
+
| `core/tools/task/commands.ts` | `getConfigDirPaths`, `findAllNearestProjectConfigDirs` | `commands/` | user+project |
|
|
64
|
+
| `core/tools/task/discovery.ts` | `getConfigDirs`, `findAllNearestProjectConfigDirs` | `agents/` | user+project |
|
|
65
|
+
| `core/tools/task/model-resolver.ts` | `readConfigFile` | `settings.json` | user |
|
|
66
|
+
| `core/tools/web-search/auth.ts` | `getConfigDirPaths` | `` (root for models.json, auth.json) | user |
|
|
67
|
+
|
|
68
|
+
## Subpath Summary
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
User-level (~/.omp/agent/, ~/.pi/agent/, ~/.claude/):
|
|
72
|
+
├── auth.json ← sdk.ts, web-search/auth.ts
|
|
73
|
+
├── models.json ← sdk.ts, web-search/auth.ts
|
|
74
|
+
├── settings.json ← settings-manager.ts, task/model-resolver.ts
|
|
75
|
+
├── commands/ ← slash-commands.ts, custom-commands/loader.ts, task/commands.ts
|
|
76
|
+
├── hooks/ ← hooks/loader.ts
|
|
77
|
+
├── tools/ ← custom-tools/loader.ts
|
|
78
|
+
├── skills/ ← skills.ts
|
|
79
|
+
├── themes/ ← theme.ts (user-level only, no fallback)
|
|
80
|
+
├── sessions/ ← session-manager.ts (user-level only, no fallback)
|
|
81
|
+
├── agents/ ← task/discovery.ts
|
|
82
|
+
└── AGENTS.md ← system-prompt.ts
|
|
83
|
+
|
|
84
|
+
User-level root (~/.omp/, ~/.pi/, ~/.claude/) - not under agent/:
|
|
85
|
+
├── mcp.json ← mcp/config.ts
|
|
86
|
+
├── plugins/ ← plugins/paths.ts (primary only)
|
|
87
|
+
└── logs/ ← logger.ts (primary only)
|
|
88
|
+
|
|
89
|
+
Project-level (.omp/, .pi/, .claude/):
|
|
90
|
+
├── SYSTEM.md ← main.ts
|
|
91
|
+
├── settings.json ← settings-manager.ts
|
|
92
|
+
├── commands/ ← slash-commands.ts, custom-commands/loader.ts, task/commands.ts
|
|
93
|
+
├── hooks/ ← hooks/loader.ts
|
|
94
|
+
├── tools/ ← custom-tools/loader.ts
|
|
95
|
+
├── skills/ ← skills.ts
|
|
96
|
+
├── agents/ ← task/discovery.ts
|
|
97
|
+
├── plugin-overrides.json ← plugins/paths.ts
|
|
98
|
+
├── lsp.json ← lsp/config.ts
|
|
99
|
+
└── .mcp.json ← mcp/config.ts
|
|
100
|
+
|
|
101
|
+
Special paths (not under agent/):
|
|
102
|
+
├── ~/.omp/plugins/ ← plugins/paths.ts
|
|
103
|
+
└── ~/.omp/logs/ ← logger.ts
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Files Using Manual Paths (Intentionally)
|
|
107
|
+
|
|
108
|
+
These files construct paths manually because they only use the primary config dir:
|
|
109
|
+
|
|
110
|
+
| File | Current Approach | Reason |
|
|
111
|
+
|------|------------------|--------|
|
|
112
|
+
| `core/logger.ts` | `CONFIG_DIR_NAME` for logs dir | Logs only written to primary (~/.omp/logs/) |
|
|
113
|
+
| `core/plugins/paths.ts` | `CONFIG_DIR_NAME` for plugins dir | Plugins only installed in primary (~/.omp/plugins/) |
|
package/docs/custom-tools.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
>
|
|
1
|
+
> omp can create custom tools. Ask it to build one for your use case.
|
|
2
2
|
|
|
3
3
|
# Custom Tools
|
|
4
4
|
|
|
@@ -32,7 +32,7 @@ See [examples/custom-tools/](../examples/custom-tools/) for working examples.
|
|
|
32
32
|
|
|
33
33
|
## Quick Start
|
|
34
34
|
|
|
35
|
-
Create a file `~/.
|
|
35
|
+
Create a file `~/.omp/agent/tools/hello/index.ts`:
|
|
36
36
|
|
|
37
37
|
```typescript
|
|
38
38
|
import type { CustomToolFactory } from "@oh-my-pi/pi-coding-agent";
|
|
@@ -57,7 +57,7 @@ const factory: CustomToolFactory = (pi) => ({
|
|
|
57
57
|
export default factory;
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
The tool is automatically discovered and available in your next
|
|
60
|
+
The tool is automatically discovered and available in your next omp session.
|
|
61
61
|
|
|
62
62
|
## Tool Locations
|
|
63
63
|
|
|
@@ -65,15 +65,15 @@ Tools must be in a subdirectory with an `index.ts` entry point:
|
|
|
65
65
|
|
|
66
66
|
| Location | Scope | Auto-discovered |
|
|
67
67
|
| ----------------------------------- | --------------------- | --------------- |
|
|
68
|
-
| `~/.
|
|
69
|
-
| `.
|
|
68
|
+
| `~/.omp/agent/tools/*/index.ts` | Global (all projects) | Yes |
|
|
69
|
+
| `.omp/tools/*/index.ts` | Project-local | Yes |
|
|
70
70
|
| `settings.json` `customTools` array | Configured paths | Yes |
|
|
71
71
|
| `--tool <path>` CLI flag | One-off/debugging | No |
|
|
72
72
|
|
|
73
73
|
**Example structure:**
|
|
74
74
|
|
|
75
75
|
```
|
|
76
|
-
~/.
|
|
76
|
+
~/.omp/agent/tools/
|
|
77
77
|
├── hello/
|
|
78
78
|
│ └── index.ts # Entry point (auto-discovered)
|
|
79
79
|
└── complex-tool/
|
|
@@ -222,7 +222,7 @@ async execute(toolCallId, params, onUpdate, ctx, signal) {
|
|
|
222
222
|
async execute(toolCallId, params, onUpdate, ctx, signal) {
|
|
223
223
|
const { path } = params as { path: string };
|
|
224
224
|
|
|
225
|
-
// Throw on error -
|
|
225
|
+
// Throw on error - omp will catch it and report to the LLM
|
|
226
226
|
if (!fs.existsSync(path)) {
|
|
227
227
|
throw new Error(`File not found: ${path}`);
|
|
228
228
|
}
|
|
@@ -537,5 +537,5 @@ See [`examples/custom-tools/todo/index.ts`](../examples/custom-tools/todo/index.
|
|
|
537
537
|
Test with:
|
|
538
538
|
|
|
539
539
|
```bash
|
|
540
|
-
|
|
540
|
+
omp --tool packages/coding-agent/examples/custom-tools/todo/index.ts
|
|
541
541
|
```
|
|
@@ -27,7 +27,7 @@ Extensions can be loaded from:
|
|
|
27
27
|
### Directories
|
|
28
28
|
```
|
|
29
29
|
./my-hooks/
|
|
30
|
-
~/.
|
|
30
|
+
~/.omp/agent/hooks/
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### npm Packages
|
|
@@ -51,7 +51,7 @@ git:https://github.com/user/repo#branch # branch
|
|
|
51
51
|
|
|
52
52
|
### Permanent (settings.json)
|
|
53
53
|
```
|
|
54
|
-
~/.
|
|
54
|
+
~/.omp/agent/
|
|
55
55
|
hooks/
|
|
56
56
|
my-local-hook.ts # root-level file
|
|
57
57
|
complex-hook/ # directory with entry point
|
|
@@ -86,7 +86,7 @@ git:https://github.com/user/repo#branch # branch
|
|
|
86
86
|
|
|
87
87
|
### Ephemeral (CLI flags)
|
|
88
88
|
```
|
|
89
|
-
/tmp/
|
|
89
|
+
/tmp/omp-extensions/
|
|
90
90
|
hooks/
|
|
91
91
|
npm/
|
|
92
92
|
my-hook@1.0.0/
|
|
@@ -148,8 +148,8 @@ scan(baseDir, config):
|
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
**Default directories scanned (always, regardless of settings.json):**
|
|
151
|
-
- `~/.
|
|
152
|
-
- `<cwd>/.
|
|
151
|
+
- `~/.omp/agent/<type>/`
|
|
152
|
+
- `<cwd>/.omp/<type>/`
|
|
153
153
|
|
|
154
154
|
## Extension Packs
|
|
155
155
|
|
|
@@ -248,58 +248,58 @@ Patterns are glob patterns matched against extension paths.
|
|
|
248
248
|
|
|
249
249
|
### Adding Sources
|
|
250
250
|
```bash
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
omp --hook <path|npm:|git:> # add hook source (repeatable)
|
|
252
|
+
omp --tool <path|npm:|git:> # add custom tool source (repeatable)
|
|
253
|
+
omp --skill <path|npm:|git:> # add skill source (repeatable)
|
|
254
|
+
omp --theme <path|npm:|git:> # add theme source (repeatable)
|
|
255
255
|
```
|
|
256
256
|
|
|
257
257
|
**Installation locations for npm/git sources:**
|
|
258
258
|
|
|
259
259
|
| Source | Install location |
|
|
260
260
|
|--------|------------------|
|
|
261
|
-
| CLI flags | `/tmp/
|
|
262
|
-
| Global settings (`~/.
|
|
263
|
-
| Project settings (`<cwd>/.
|
|
261
|
+
| CLI flags | `/tmp/omp-extensions/<type>/npm/` or `git/` |
|
|
262
|
+
| Global settings (`~/.omp/agent/settings.json`) | `~/.omp/agent/<type>/npm/` or `git/` |
|
|
263
|
+
| Project settings (`<cwd>/.omp/settings.json`) | `<cwd>/.omp/<type>/npm/` or `git/` |
|
|
264
264
|
|
|
265
265
|
File/directory paths are used directly (no installation).
|
|
266
266
|
|
|
267
267
|
- **CLI = ephemeral**: cached in temp until OS clears `/tmp/`
|
|
268
268
|
- **Global settings = permanent**: installed to user's agent directory
|
|
269
|
-
- **Project settings = project-local**: installed to project's `.
|
|
269
|
+
- **Project settings = project-local**: installed to project's `.omp/` directory
|
|
270
270
|
|
|
271
271
|
Examples:
|
|
272
|
-
- `--hook npm:my-hook@1.0.0` → `/tmp/
|
|
273
|
-
- Global settings.json `npm:my-hook@1.0.0` → `~/.
|
|
274
|
-
- Project settings.json `npm:my-hook@1.0.0` → `<cwd>/.
|
|
272
|
+
- `--hook npm:my-hook@1.0.0` → `/tmp/omp-extensions/hooks/npm/my-hook@1.0.0/`
|
|
273
|
+
- Global settings.json `npm:my-hook@1.0.0` → `~/.omp/agent/hooks/npm/my-hook@1.0.0/`
|
|
274
|
+
- Project settings.json `npm:my-hook@1.0.0` → `<cwd>/.omp/hooks/npm/my-hook@1.0.0/`
|
|
275
275
|
|
|
276
276
|
This encourages: try via CLI, if you like it, add to settings.json for permanent install.
|
|
277
277
|
|
|
278
278
|
### Filtering
|
|
279
279
|
```bash
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
280
|
+
omp --hooks "pattern1,pattern2,!excluded" # filter hooks
|
|
281
|
+
omp --custom-tools "pattern1,!excluded" # filter custom tools
|
|
282
|
+
omp --skills "pattern1,pattern2" # filter skills
|
|
283
|
+
omp --themes "pattern1" # filter themes
|
|
284
284
|
```
|
|
285
285
|
|
|
286
286
|
### Disabling
|
|
287
287
|
```bash
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
omp --no-hooks # disable all hooks
|
|
289
|
+
omp --no-custom-tools # disable all custom tools
|
|
290
|
+
omp --no-skills # disable all skills (already exists)
|
|
291
291
|
```
|
|
292
292
|
|
|
293
293
|
### Built-in Tools
|
|
294
294
|
```bash
|
|
295
|
-
|
|
295
|
+
omp --tools read,bash,edit,write # select which built-in tools to enable (unchanged)
|
|
296
296
|
```
|
|
297
297
|
|
|
298
298
|
## Settings Hierarchy
|
|
299
299
|
|
|
300
300
|
Extensions are configured in settings.json at two levels:
|
|
301
|
-
- **Global**: `~/.
|
|
302
|
-
- **Project**: `<cwd>/.
|
|
301
|
+
- **Global**: `~/.omp/agent/settings.json`
|
|
302
|
+
- **Project**: `<cwd>/.omp/settings.json`
|
|
303
303
|
|
|
304
304
|
**Merge behavior:**
|
|
305
305
|
- `paths`: **additive** - project paths are added to global paths
|
|
@@ -307,7 +307,7 @@ Extensions are configured in settings.json at two levels:
|
|
|
307
307
|
|
|
308
308
|
**Example:**
|
|
309
309
|
```json
|
|
310
|
-
// Global: ~/.
|
|
310
|
+
// Global: ~/.omp/agent/settings.json
|
|
311
311
|
{
|
|
312
312
|
"hooks": {
|
|
313
313
|
"paths": ["npm:audit-hooks@1.0.0"],
|
|
@@ -315,7 +315,7 @@ Extensions are configured in settings.json at two levels:
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
// Project: .
|
|
318
|
+
// Project: .omp/settings.json
|
|
319
319
|
{
|
|
320
320
|
"hooks": {
|
|
321
321
|
"paths": ["./project-hooks/"],
|
|
@@ -368,9 +368,9 @@ Extensions are configured in settings.json at two levels:
|
|
|
368
368
|
## Installation Flow
|
|
369
369
|
|
|
370
370
|
Target directory depends on source:
|
|
371
|
-
- **CLI flags**: `/tmp/
|
|
372
|
-
- **Global settings.json**: `~/.
|
|
373
|
-
- **Project settings.json**: `<cwd>/.
|
|
371
|
+
- **CLI flags**: `/tmp/omp-extensions/<type>/npm/` or `git/`
|
|
372
|
+
- **Global settings.json**: `~/.omp/agent/<type>/npm/` or `git/`
|
|
373
|
+
- **Project settings.json**: `<cwd>/.omp/<type>/npm/` or `git/`
|
|
374
374
|
|
|
375
375
|
### Atomic Installation
|
|
376
376
|
|
|
@@ -382,7 +382,7 @@ To prevent corrupted state from interrupted installs (Ctrl+C):
|
|
|
382
382
|
|
|
383
383
|
### npm Packages
|
|
384
384
|
1. Parse specifier: `npm:@scope/pkg@1.2.3` → name: `@scope/pkg`, version: `1.2.3`
|
|
385
|
-
2. Determine target dir based on source (CLI → temp, global → agent dir, project → cwd/.
|
|
385
|
+
2. Determine target dir based on source (CLI → temp, global → agent dir, project → cwd/.omp/)
|
|
386
386
|
3. If `<target>/` exists and has matching version in package.json → skip install
|
|
387
387
|
4. Otherwise:
|
|
388
388
|
- Remove stale `<target>.installing/` if exists
|
|
@@ -393,7 +393,7 @@ To prevent corrupted state from interrupted installs (Ctrl+C):
|
|
|
393
393
|
|
|
394
394
|
### Git Repositories
|
|
395
395
|
1. Parse specifier: `git:https://github.com/user/repo@v1.0.0`
|
|
396
|
-
2. Determine target dir based on source (CLI → temp, global → agent dir, project → cwd/.
|
|
396
|
+
2. Determine target dir based on source (CLI → temp, global → agent dir, project → cwd/.omp/)
|
|
397
397
|
3. If `<target>/` exists → skip clone
|
|
398
398
|
4. Otherwise:
|
|
399
399
|
- Remove stale `<target>.installing/` if exists
|
|
@@ -409,18 +409,18 @@ To prevent corrupted state from interrupted installs (Ctrl+C):
|
|
|
409
409
|
Adds extension to settings.json and installs to disk.
|
|
410
410
|
|
|
411
411
|
```bash
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
412
|
+
omp install <type> <source> # global (default)
|
|
413
|
+
omp install <type> -p <source> # project-local
|
|
414
|
+
omp install <type> --project <source> # project-local
|
|
415
415
|
|
|
416
416
|
# Examples:
|
|
417
|
-
|
|
418
|
-
# → adds to ~/.
|
|
419
|
-
# → installs to ~/.
|
|
417
|
+
omp install hook npm:@scope/my-hook@1.0.0
|
|
418
|
+
# → adds to ~/.omp/agent/settings.json
|
|
419
|
+
# → installs to ~/.omp/agent/hooks/npm/@scope/my-hook@1.0.0/
|
|
420
420
|
|
|
421
|
-
|
|
422
|
-
# → adds to <cwd>/.
|
|
423
|
-
# → installs to <cwd>/.
|
|
421
|
+
omp install tool -p git:https://github.com/user/tool@v1.0.0
|
|
422
|
+
# → adds to <cwd>/.omp/settings.json
|
|
423
|
+
# → installs to <cwd>/.omp/tools/git/github.com/user/tool@v1.0.0/
|
|
424
424
|
```
|
|
425
425
|
|
|
426
426
|
### Remove
|
|
@@ -428,12 +428,12 @@ pi install tool -p git:https://github.com/user/tool@v1.0.0
|
|
|
428
428
|
Removes extension from settings.json and deletes from disk.
|
|
429
429
|
|
|
430
430
|
```bash
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
omp remove <type> <name> # from global
|
|
432
|
+
omp remove <type> -p <name> # from project
|
|
433
433
|
|
|
434
434
|
# Examples:
|
|
435
|
-
|
|
436
|
-
|
|
435
|
+
omp remove hook my-hook # from ~/.omp/agent/settings.json + delete
|
|
436
|
+
omp remove skill -p brave-search # from <cwd>/.omp/settings.json + delete
|
|
437
437
|
```
|
|
438
438
|
|
|
439
439
|
### Update
|
|
@@ -441,15 +441,15 @@ pi remove skill -p brave-search # from <cwd>/.pi/settings.json + delete
|
|
|
441
441
|
Updates npm/git extensions to latest versions.
|
|
442
442
|
|
|
443
443
|
```bash
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
444
|
+
omp update # all (project + global)
|
|
445
|
+
omp update -p # project only
|
|
446
|
+
omp update <type>... # specific types
|
|
447
|
+
omp update -p <type>... # project, specific types
|
|
448
448
|
|
|
449
449
|
# Examples:
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
450
|
+
omp update # update everything
|
|
451
|
+
omp update hook tool # update hooks and tools
|
|
452
|
+
omp update -p skill # update project skills only
|
|
453
453
|
```
|
|
454
454
|
|
|
455
455
|
**Update behavior:**
|
|
@@ -461,13 +461,13 @@ pi update -p skill # update project skills only
|
|
|
461
461
|
## Loading Flow (Full)
|
|
462
462
|
|
|
463
463
|
1. **Collect sources:**
|
|
464
|
-
- Default directories: `~/.
|
|
464
|
+
- Default directories: `~/.omp/agent/<type>/`, `./.omp/<type>/`
|
|
465
465
|
- settings.json `<type>.paths`
|
|
466
466
|
- CLI `--<type>` arguments
|
|
467
467
|
|
|
468
|
-
|
|
468
|
+
3. **Install remote sources:**
|
|
469
469
|
- Process `npm:` and `git:` specifiers
|
|
470
|
-
- Install to `~/.
|
|
470
|
+
- Install to `~/.omp/agent/<type>/npm/` or `git/`
|
|
471
471
|
|
|
472
472
|
3. **Scan all sources:**
|
|
473
473
|
- Recursively discover extensions
|
|
@@ -621,7 +621,7 @@ export interface LoadExtensionsOptions {
|
|
|
621
621
|
cwd: string;
|
|
622
622
|
agentDir: string;
|
|
623
623
|
globalPaths: string[]; // from global settings.json → install to agentDir
|
|
624
|
-
projectPaths: string[]; // from project settings.json → install to cwd/.
|
|
624
|
+
projectPaths: string[]; // from project settings.json → install to cwd/.omp/
|
|
625
625
|
cliPaths: string[]; // from CLI flags → install to /tmp/
|
|
626
626
|
filter: string[]; // combined filter patterns
|
|
627
627
|
}
|
|
@@ -656,7 +656,7 @@ export function getSkillsDir(): string {
|
|
|
656
656
|
|
|
657
657
|
// getToolsDir() already exists
|
|
658
658
|
// getThemesDir() = bundled themes (in package)
|
|
659
|
-
// getCustomThemesDir() = ~/.
|
|
659
|
+
// getCustomThemesDir() = ~/.omp/agent/themes/ (user themes) - already exists
|
|
660
660
|
```
|
|
661
661
|
|
|
662
662
|
### `src/core/settings-manager.ts`
|
package/docs/hooks.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
>
|
|
1
|
+
> omp can create hooks. Ask it to build one for your use case.
|
|
2
2
|
|
|
3
3
|
# Hooks
|
|
4
4
|
|
|
5
|
-
Hooks are TypeScript modules that extend
|
|
5
|
+
Hooks are TypeScript modules that extend omp's behavior by subscribing to lifecycle events. They can intercept tool calls, prompt the user, modify results, inject messages, and more.
|
|
6
6
|
|
|
7
7
|
**Key capabilities:**
|
|
8
8
|
|
|
@@ -24,7 +24,7 @@ See [examples/hooks/](../examples/hooks/) for working implementations, including
|
|
|
24
24
|
|
|
25
25
|
## Quick Start
|
|
26
26
|
|
|
27
|
-
Create `~/.
|
|
27
|
+
Create `~/.omp/agent/hooks/my-hook.ts`:
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
30
|
import type { HookAPI } from "@oh-my-pi/pi-coding-agent";
|
|
@@ -46,17 +46,17 @@ export default function (pi: HookAPI) {
|
|
|
46
46
|
Test with `--hook` flag:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
|
|
49
|
+
omp --hook ./my-hook.ts
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## Hook Locations
|
|
53
53
|
|
|
54
54
|
Hooks are auto-discovered from:
|
|
55
55
|
|
|
56
|
-
| Location
|
|
57
|
-
|
|
|
58
|
-
| `~/.
|
|
59
|
-
| `.
|
|
56
|
+
| Location | Scope |
|
|
57
|
+
| ------------------------- | --------------------- |
|
|
58
|
+
| `~/.omp/agent/hooks/*.ts` | Global (all projects) |
|
|
59
|
+
| `.omp/hooks/*.ts` | Project-local |
|
|
60
60
|
|
|
61
61
|
Additional paths via `settings.json`:
|
|
62
62
|
|
|
@@ -99,7 +99,7 @@ Hooks are loaded via [jiti](https://github.com/unjs/jiti), so TypeScript works w
|
|
|
99
99
|
### Lifecycle Overview
|
|
100
100
|
|
|
101
101
|
```
|
|
102
|
-
|
|
102
|
+
omp starts
|
|
103
103
|
│
|
|
104
104
|
└─► session_start
|
|
105
105
|
│
|
|
@@ -509,7 +509,7 @@ Read-only access to session state. See `ReadonlySessionManager` in [`src/core/se
|
|
|
509
509
|
```typescript
|
|
510
510
|
// Session info
|
|
511
511
|
ctx.sessionManager.getCwd(); // Working directory
|
|
512
|
-
ctx.sessionManager.getSessionDir(); // Session directory (~/.
|
|
512
|
+
ctx.sessionManager.getSessionDir(); // Session directory (~/.omp/agent/sessions)
|
|
513
513
|
ctx.sessionManager.getSessionId(); // Current session ID
|
|
514
514
|
ctx.sessionManager.getSessionFile(); // Session file path (undefined with --no-session)
|
|
515
515
|
|
|
@@ -864,4 +864,4 @@ In print mode, `select()` returns `undefined`, `confirm()` returns `false`, `inp
|
|
|
864
864
|
1. Open VS Code in hooks directory
|
|
865
865
|
2. Open JavaScript Debug Terminal (Ctrl+Shift+P → "JavaScript Debug Terminal")
|
|
866
866
|
3. Set breakpoints
|
|
867
|
-
4. Run `
|
|
867
|
+
4. Run `omp --hook ./my-hook.ts`
|
package/docs/rpc.md
CHANGED
|
@@ -7,7 +7,7 @@ RPC mode enables headless operation of the coding agent via a JSON protocol over
|
|
|
7
7
|
## Starting RPC Mode
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
omp --mode rpc [options]
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
Common options:
|
|
@@ -407,7 +407,7 @@ If output was truncated, includes `fullOutputPath`:
|
|
|
407
407
|
"exitCode": 0,
|
|
408
408
|
"cancelled": false,
|
|
409
409
|
"truncated": true,
|
|
410
|
-
"fullOutputPath": "/tmp/
|
|
410
|
+
"fullOutputPath": "/tmp/omp-bash-abc123.log"
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
```
|
|
@@ -980,7 +980,7 @@ import subprocess
|
|
|
980
980
|
import json
|
|
981
981
|
|
|
982
982
|
proc = subprocess.Popen(
|
|
983
|
-
["
|
|
983
|
+
["omp", "--mode", "rpc", "--no-session"],
|
|
984
984
|
stdin=subprocess.PIPE,
|
|
985
985
|
stdout=subprocess.PIPE,
|
|
986
986
|
text=True
|
|
@@ -1017,7 +1017,7 @@ See [`test/rpc-example.ts`](../test/rpc-example.ts) for a complete interactive e
|
|
|
1017
1017
|
const { spawn } = require("child_process");
|
|
1018
1018
|
const readline = require("readline");
|
|
1019
1019
|
|
|
1020
|
-
const agent = spawn("
|
|
1020
|
+
const agent = spawn("omp", ["--mode", "rpc", "--no-session"]);
|
|
1021
1021
|
|
|
1022
1022
|
readline.createInterface({ input: agent.stdout }).on("line", (line) => {
|
|
1023
1023
|
const event = JSON.parse(line);
|
package/docs/sdk.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
>
|
|
1
|
+
> omp can help you use the SDK. Ask it to build an integration for your use case.
|
|
2
2
|
|
|
3
3
|
# SDK
|
|
4
4
|
|
|
5
|
-
The SDK provides programmatic access to
|
|
5
|
+
The SDK provides programmatic access to omp's agent capabilities. Use it to embed omp in other applications, build custom interfaces, or integrate with automated workflows.
|
|
6
6
|
|
|
7
7
|
**Example use cases:**
|
|
8
8
|
|
|
@@ -60,7 +60,7 @@ The main factory function. Creates an `AgentSession` with configurable options.
|
|
|
60
60
|
```typescript
|
|
61
61
|
import { createAgentSession } from "@oh-my-pi/pi-coding-agent";
|
|
62
62
|
|
|
63
|
-
// Minimal: all defaults (discovers everything from cwd and ~/.
|
|
63
|
+
// Minimal: all defaults (discovers everything from cwd and ~/.omp/agent)
|
|
64
64
|
const { session } = await createAgentSession();
|
|
65
65
|
|
|
66
66
|
// Custom: override specific options
|
|
@@ -220,16 +220,16 @@ const { session } = await createAgentSession({
|
|
|
220
220
|
cwd: process.cwd(), // default
|
|
221
221
|
|
|
222
222
|
// Global config directory
|
|
223
|
-
agentDir: "~/.
|
|
223
|
+
agentDir: "~/.omp/agent", // default (expands ~)
|
|
224
224
|
});
|
|
225
225
|
```
|
|
226
226
|
|
|
227
227
|
`cwd` is used for:
|
|
228
228
|
|
|
229
|
-
- Project hooks (`.
|
|
230
|
-
- Project tools (`.
|
|
231
|
-
- Project skills (`.
|
|
232
|
-
- Project commands (`.
|
|
229
|
+
- Project hooks (`.omp/hooks/`)
|
|
230
|
+
- Project tools (`.omp/tools/`)
|
|
231
|
+
- Project skills (`.omp/skills/`)
|
|
232
|
+
- Project commands (`.omp/commands/`)
|
|
233
233
|
- Context files (`AGENTS.md` walking up from cwd)
|
|
234
234
|
- Session directory naming
|
|
235
235
|
|
|
@@ -300,7 +300,7 @@ API key resolution priority (handled by AuthStorage):
|
|
|
300
300
|
```typescript
|
|
301
301
|
import { AuthStorage, ModelRegistry, discoverAuthStorage, discoverModels } from "@oh-my-pi/pi-coding-agent";
|
|
302
302
|
|
|
303
|
-
// Default: uses ~/.
|
|
303
|
+
// Default: uses ~/.omp/agent/auth.json and ~/.omp/agent/models.json
|
|
304
304
|
const authStorage = discoverAuthStorage();
|
|
305
305
|
const modelRegistry = discoverModels(authStorage);
|
|
306
306
|
|
|
@@ -721,8 +721,8 @@ const { session } = await createAgentSession({
|
|
|
721
721
|
|
|
722
722
|
Settings load from two locations and merge:
|
|
723
723
|
|
|
724
|
-
1. Global: `~/.
|
|
725
|
-
2. Project: `<cwd>/.
|
|
724
|
+
1. Global: `~/.omp/agent/settings.json`
|
|
725
|
+
2. Project: `<cwd>/.omp/settings.json`
|
|
726
726
|
|
|
727
727
|
Project overrides global. Nested objects merge keys. Setters only modify global (project is read-only for version control).
|
|
728
728
|
|
|
@@ -749,8 +749,8 @@ import {
|
|
|
749
749
|
} from "@oh-my-pi/pi-coding-agent";
|
|
750
750
|
|
|
751
751
|
// Auth and Models
|
|
752
|
-
const authStorage = discoverAuthStorage(); // ~/.
|
|
753
|
-
const modelRegistry = discoverModels(authStorage); // + ~/.
|
|
752
|
+
const authStorage = discoverAuthStorage(); // ~/.omp/agent/auth.json
|
|
753
|
+
const modelRegistry = discoverModels(authStorage); // + ~/.omp/agent/models.json
|
|
754
754
|
const allModels = modelRegistry.getAll(); // All models (built-in + custom)
|
|
755
755
|
const available = await modelRegistry.getAvailable(); // Only models with API keys
|
|
756
756
|
const model = modelRegistry.find("provider", "id"); // Find specific model
|
|
@@ -896,7 +896,7 @@ await session.prompt("Get status and list files.");
|
|
|
896
896
|
For subprocess-based integration, use RPC mode instead of the SDK:
|
|
897
897
|
|
|
898
898
|
```bash
|
|
899
|
-
|
|
899
|
+
omp --mode rpc --no-session
|
|
900
900
|
```
|
|
901
901
|
|
|
902
902
|
See [RPC documentation](rpc.md) for the JSON protocol.
|
|
@@ -87,7 +87,7 @@ export interface BranchSummaryEntry extends SessionEntryBase {
|
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
- [x] `fromId` field references the abandoned leaf
|
|
90
|
-
- [x] `fromHook` field distinguishes
|
|
90
|
+
- [x] `fromHook` field distinguishes omp-generated vs hook-generated summaries
|
|
91
91
|
- [x] `details` field for file tracking
|
|
92
92
|
- [x] Branch summarizer implemented with structured output format
|
|
93
93
|
- [x] Uses serialization approach (same as compaction) to prevent model confusion
|
package/docs/session.md
CHANGED
|
@@ -5,7 +5,7 @@ Sessions are stored as JSONL (JSON Lines) files. Each line is a JSON object with
|
|
|
5
5
|
## File Location
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
~/.
|
|
8
|
+
~/.omp/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Where `<path>` is the working directory with `/` replaced by `-`.
|
|
@@ -90,7 +90,7 @@ Created when context is compacted. Stores a summary of earlier messages.
|
|
|
90
90
|
|
|
91
91
|
Optional fields:
|
|
92
92
|
- `details`: Compaction-implementation specific data (e.g., file operations for default implementation, or custom data for custom hook implementations)
|
|
93
|
-
- `fromHook`: `true` if generated by a hook, `false`/`undefined` if
|
|
93
|
+
- `fromHook`: `true` if generated by a hook, `false`/`undefined` if omp-generated
|
|
94
94
|
|
|
95
95
|
### BranchSummaryEntry
|
|
96
96
|
|