@draht/coding-agent 2026.3.2 → 2026.3.4
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 +194 -13
- package/README.md +90 -106
- package/agents/architect.md +45 -0
- package/agents/debugger.md +57 -0
- package/agents/git-committer.md +46 -0
- package/agents/implementer.md +25 -0
- package/agents/reviewer.md +52 -0
- package/agents/security-auditor.md +61 -0
- package/agents/verifier.md +44 -0
- package/bin/draht-tools.cjs +20 -20
- package/dist/agents/architect.md +45 -0
- package/dist/agents/debugger.md +57 -0
- package/dist/agents/git-committer.md +46 -0
- package/dist/agents/implementer.md +25 -0
- package/dist/agents/reviewer.md +52 -0
- package/dist/agents/security-auditor.md +61 -0
- package/dist/agents/verifier.md +44 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +0 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -14
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +14 -4
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +167 -49
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +2 -1
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/builtins/subagent.d.ts +14 -0
- package/dist/core/builtins/subagent.d.ts.map +1 -0
- package/dist/core/builtins/subagent.js +492 -0
- package/dist/core/builtins/subagent.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +4 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +6 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +19 -8
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +8 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-registry.d.ts +1 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +9 -6
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +35 -5
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resource-loader.d.ts +2 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +5 -1
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +4 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts +4 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +34 -12
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +5 -5
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +3 -3
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/armin.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/daxnuts.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts +5 -2
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +9 -1
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +1 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +1 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +1 -1
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +28 -3
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +1 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +11 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +28 -27
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -1
- package/dist/modes/interactive/theme/light.json +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +5 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/prompts/commands/discuss-phase.md +3 -3
- package/dist/prompts/commands/execute-phase.md +9 -9
- package/dist/prompts/commands/fix.md +29 -0
- package/dist/prompts/commands/init-project.md +49 -0
- package/dist/prompts/commands/map-codebase.md +2 -2
- package/dist/prompts/commands/new-project.md +9 -9
- package/dist/prompts/commands/next-milestone.md +44 -0
- package/dist/prompts/commands/pause-work.md +2 -2
- package/dist/prompts/commands/plan-phase.md +5 -5
- package/dist/prompts/commands/progress.md +1 -1
- package/dist/prompts/commands/quick.md +4 -4
- package/dist/prompts/commands/resume-work.md +1 -1
- package/dist/prompts/commands/review.md +26 -0
- package/dist/prompts/commands/verify-work.md +4 -4
- package/docs/compaction.md +14 -14
- package/docs/custom-provider.md +19 -11
- package/docs/development.md +1 -1
- package/docs/extensions.md +52 -33
- package/docs/json.md +4 -4
- package/docs/packages.md +1 -1
- package/docs/providers.md +4 -2
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +24 -24
- package/docs/session.md +6 -6
- package/docs/settings.md +1 -0
- package/docs/termux.md +1 -1
- package/docs/themes.md +2 -2
- package/docs/tui.md +20 -20
- package/examples/extensions/README.md +5 -4
- package/examples/extensions/antigravity-image-gen.ts +3 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/doom-overlay/README.md +1 -1
- package/examples/extensions/dynamic-resources/dynamic.json +1 -1
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/subagent/README.md +11 -11
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/README.md +3 -3
- package/package.json +11 -8
- package/prompts/commands/discuss-phase.md +3 -3
- package/prompts/commands/execute-phase.md +9 -9
- package/prompts/commands/fix.md +29 -0
- package/prompts/commands/init-project.md +49 -0
- package/prompts/commands/map-codebase.md +2 -2
- package/prompts/commands/new-project.md +9 -9
- package/prompts/commands/next-milestone.md +44 -0
- package/prompts/commands/pause-work.md +2 -2
- package/prompts/commands/plan-phase.md +5 -5
- package/prompts/commands/progress.md +1 -1
- package/prompts/commands/quick.md +4 -4
- package/prompts/commands/resume-work.md +1 -1
- package/prompts/commands/review.md +26 -0
- package/prompts/commands/verify-work.md +4 -4
- package/dist/extensions/gsd-commands.ts +0 -338
- package/dist/extensions/subagent.ts +0 -312
- package/extensions/gsd-commands.ts +0 -338
- package/extensions/subagent.ts +0 -312
package/docs/extensions.md
CHANGED
|
@@ -55,7 +55,7 @@ See [examples/extensions/](../examples/extensions/) for working implementations.
|
|
|
55
55
|
Create `~/.pi/agent/extensions/my-extension.ts`:
|
|
56
56
|
|
|
57
57
|
```typescript
|
|
58
|
-
import type { ExtensionAPI } from "@
|
|
58
|
+
import type { ExtensionAPI } from "@draht/coding-agent";
|
|
59
59
|
import { Type } from "@sinclair/typebox";
|
|
60
60
|
|
|
61
61
|
export default function (pi: ExtensionAPI) {
|
|
@@ -137,10 +137,10 @@ To share extensions via npm or git as pi packages, see [packages.md](packages.md
|
|
|
137
137
|
|
|
138
138
|
| Package | Purpose |
|
|
139
139
|
|---------|---------|
|
|
140
|
-
| `@
|
|
140
|
+
| `@draht/coding-agent` | Extension types (`ExtensionAPI`, `ExtensionContext`, events) |
|
|
141
141
|
| `@sinclair/typebox` | Schema definitions for tool parameters |
|
|
142
|
-
| `@
|
|
143
|
-
| `@
|
|
142
|
+
| `@draht/ai` | AI utilities (`StringEnum` for Google-compatible enums) |
|
|
143
|
+
| `@draht/tui` | TUI components for custom rendering |
|
|
144
144
|
|
|
145
145
|
npm dependencies work too. Add a `package.json` next to your extension (or in a parent directory), run `npm install`, and imports from `node_modules/` are resolved automatically.
|
|
146
146
|
|
|
@@ -151,7 +151,7 @@ Node.js built-ins (`node:fs`, `node:path`, etc.) are also available.
|
|
|
151
151
|
An extension exports a default function that receives `ExtensionAPI`:
|
|
152
152
|
|
|
153
153
|
```typescript
|
|
154
|
-
import type { ExtensionAPI } from "@
|
|
154
|
+
import type { ExtensionAPI } from "@draht/coding-agent";
|
|
155
155
|
|
|
156
156
|
export default function (pi: ExtensionAPI) {
|
|
157
157
|
// Subscribe to events
|
|
@@ -519,7 +519,7 @@ Use this to update UI elements (status bars, footers) or perform model-specific
|
|
|
519
519
|
Fired before tool executes. **Can block.** Use `isToolCallEventType` to narrow and get typed inputs.
|
|
520
520
|
|
|
521
521
|
```typescript
|
|
522
|
-
import { isToolCallEventType } from "@
|
|
522
|
+
import { isToolCallEventType } from "@draht/coding-agent";
|
|
523
523
|
|
|
524
524
|
pi.on("tool_call", async (event, ctx) => {
|
|
525
525
|
// event.toolName - "bash", "read", "write", "edit", etc.
|
|
@@ -553,7 +553,7 @@ export type MyToolInput = Static<typeof myToolSchema>;
|
|
|
553
553
|
Use `isToolCallEventType` with explicit type parameters:
|
|
554
554
|
|
|
555
555
|
```typescript
|
|
556
|
-
import { isToolCallEventType } from "@
|
|
556
|
+
import { isToolCallEventType } from "@draht/coding-agent";
|
|
557
557
|
import type { MyToolInput } from "my-extension";
|
|
558
558
|
|
|
559
559
|
pi.on("tool_call", (event) => {
|
|
@@ -573,7 +573,7 @@ Fired after tool executes. **Can modify result.**
|
|
|
573
573
|
- Handlers can return partial patches (`content`, `details`, or `isError`); omitted fields keep their current values
|
|
574
574
|
|
|
575
575
|
```typescript
|
|
576
|
-
import { isBashToolResult } from "@
|
|
576
|
+
import { isBashToolResult } from "@draht/coding-agent";
|
|
577
577
|
|
|
578
578
|
pi.on("tool_result", async (event, ctx) => {
|
|
579
579
|
// event.toolName, event.toolCallId, event.input
|
|
@@ -843,7 +843,7 @@ Tools run with `ExtensionContext`, so they cannot call `ctx.reload()` directly.
|
|
|
843
843
|
Example tool the LLM can call to trigger reload:
|
|
844
844
|
|
|
845
845
|
```typescript
|
|
846
|
-
import type { ExtensionAPI } from "@
|
|
846
|
+
import type { ExtensionAPI } from "@draht/coding-agent";
|
|
847
847
|
import { Type } from "@sinclair/typebox";
|
|
848
848
|
|
|
849
849
|
export default function (pi: ExtensionAPI) {
|
|
@@ -880,14 +880,24 @@ Subscribe to events. See [Events](#events) for event types and return values.
|
|
|
880
880
|
|
|
881
881
|
Register a custom tool callable by the LLM. See [Custom Tools](#custom-tools) for full details.
|
|
882
882
|
|
|
883
|
+
`pi.registerTool()` works both during extension load and after startup. You can call it inside `session_start`, command handlers, or other event handlers. New tools are refreshed immediately in the same session, so they appear in `pi.getAllTools()` and are callable by the LLM without `/reload`.
|
|
884
|
+
|
|
885
|
+
Use `pi.setActiveTools()` to enable or disable tools (including dynamically added tools) at runtime.
|
|
886
|
+
|
|
887
|
+
Use `promptSnippet` to customize that tool's one-line entry in `Available tools`, and `promptGuidelines` to append tool-specific bullets to the default `Guidelines` section when the tool is active.
|
|
888
|
+
|
|
889
|
+
See [dynamic-tools.ts](../examples/extensions/dynamic-tools.ts) for a full example.
|
|
890
|
+
|
|
883
891
|
```typescript
|
|
884
892
|
import { Type } from "@sinclair/typebox";
|
|
885
|
-
import { StringEnum } from "@
|
|
893
|
+
import { StringEnum } from "@draht/ai";
|
|
886
894
|
|
|
887
895
|
pi.registerTool({
|
|
888
896
|
name: "my_tool",
|
|
889
897
|
label: "My Tool",
|
|
890
898
|
description: "What this tool does",
|
|
899
|
+
promptSnippet: "Summarize or transform text according to action",
|
|
900
|
+
promptGuidelines: ["Use this tool when the user asks to summarize previously generated text."],
|
|
891
901
|
parameters: Type.Object({
|
|
892
902
|
action: StringEnum(["list", "add"] as const),
|
|
893
903
|
text: Type.Optional(Type.String()),
|
|
@@ -1030,7 +1040,7 @@ pi.registerCommand("stats", {
|
|
|
1030
1040
|
Optional: add argument auto-completion for `/command ...`:
|
|
1031
1041
|
|
|
1032
1042
|
```typescript
|
|
1033
|
-
import type { AutocompleteItem } from "@
|
|
1043
|
+
import type { AutocompleteItem } from "@draht/tui";
|
|
1034
1044
|
|
|
1035
1045
|
pi.registerCommand("deploy", {
|
|
1036
1046
|
description: "Deploy to an environment",
|
|
@@ -1116,7 +1126,7 @@ const result = await pi.exec("git", ["status"], { signal, timeout: 5000 });
|
|
|
1116
1126
|
|
|
1117
1127
|
### pi.getActiveTools() / pi.getAllTools() / pi.setActiveTools(names)
|
|
1118
1128
|
|
|
1119
|
-
Manage active tools.
|
|
1129
|
+
Manage active tools. This works for both built-in tools and dynamically registered tools.
|
|
1120
1130
|
|
|
1121
1131
|
```typescript
|
|
1122
1132
|
const active = pi.getActiveTools(); // ["read", "bash", "edit", "write"]
|
|
@@ -1276,19 +1286,27 @@ export default function (pi: ExtensionAPI) {
|
|
|
1276
1286
|
|
|
1277
1287
|
Register tools the LLM can call via `pi.registerTool()`. Tools appear in the system prompt and can have custom rendering.
|
|
1278
1288
|
|
|
1289
|
+
Use `promptSnippet` for a short one-line entry in the `Available tools` section in the default system prompt. If omitted, pi falls back to `description`.
|
|
1290
|
+
|
|
1291
|
+
Use `promptGuidelines` to add tool-specific bullets to the default system prompt `Guidelines` section. These bullets are included only while the tool is active (for example, after `pi.setActiveTools([...])`).
|
|
1292
|
+
|
|
1279
1293
|
Note: Some models are idiots and include the @ prefix in tool path arguments. Built-in tools strip a leading @ before resolving paths. If your custom tool accepts a path, normalize a leading @ as well.
|
|
1280
1294
|
|
|
1281
1295
|
### Tool Definition
|
|
1282
1296
|
|
|
1283
1297
|
```typescript
|
|
1284
1298
|
import { Type } from "@sinclair/typebox";
|
|
1285
|
-
import { StringEnum } from "@
|
|
1286
|
-
import { Text } from "@
|
|
1299
|
+
import { StringEnum } from "@draht/ai";
|
|
1300
|
+
import { Text } from "@draht/tui";
|
|
1287
1301
|
|
|
1288
1302
|
pi.registerTool({
|
|
1289
1303
|
name: "my_tool",
|
|
1290
1304
|
label: "My Tool",
|
|
1291
1305
|
description: "What this tool does (shown to LLM)",
|
|
1306
|
+
promptSnippet: "List or add items in the project todo list",
|
|
1307
|
+
promptGuidelines: [
|
|
1308
|
+
"Use this tool for todo planning instead of direct file edits when the user asks for a task list."
|
|
1309
|
+
],
|
|
1292
1310
|
parameters: Type.Object({
|
|
1293
1311
|
action: StringEnum(["list", "add"] as const), // Use StringEnum for Google compatibility
|
|
1294
1312
|
text: Type.Optional(Type.String()),
|
|
@@ -1322,7 +1340,7 @@ pi.registerTool({
|
|
|
1322
1340
|
});
|
|
1323
1341
|
```
|
|
1324
1342
|
|
|
1325
|
-
**Important:** Use `StringEnum` from `@
|
|
1343
|
+
**Important:** Use `StringEnum` from `@draht/ai` for string enums. `Type.Union`/`Type.Literal` doesn't work with Google's API.
|
|
1326
1344
|
|
|
1327
1345
|
### Overriding Built-in Tools
|
|
1328
1346
|
|
|
@@ -1346,20 +1364,20 @@ See [examples/extensions/tool-override.ts](../examples/extensions/tool-override.
|
|
|
1346
1364
|
**Your implementation must match the exact result shape**, including the `details` type. The UI and session logic depend on these shapes for rendering and state tracking.
|
|
1347
1365
|
|
|
1348
1366
|
Built-in tool implementations:
|
|
1349
|
-
- [read.ts](https://github.com/
|
|
1350
|
-
- [bash.ts](https://github.com/
|
|
1351
|
-
- [edit.ts](https://github.com/
|
|
1352
|
-
- [write.ts](https://github.com/
|
|
1353
|
-
- [grep.ts](https://github.com/
|
|
1354
|
-
- [find.ts](https://github.com/
|
|
1355
|
-
- [ls.ts](https://github.com/
|
|
1367
|
+
- [read.ts](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/tools/read.ts) - `ReadToolDetails`
|
|
1368
|
+
- [bash.ts](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/tools/bash.ts) - `BashToolDetails`
|
|
1369
|
+
- [edit.ts](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/tools/edit.ts)
|
|
1370
|
+
- [write.ts](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/tools/write.ts)
|
|
1371
|
+
- [grep.ts](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/tools/grep.ts) - `GrepToolDetails`
|
|
1372
|
+
- [find.ts](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/tools/find.ts) - `FindToolDetails`
|
|
1373
|
+
- [ls.ts](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/tools/ls.ts) - `LsToolDetails`
|
|
1356
1374
|
|
|
1357
1375
|
### Remote Execution
|
|
1358
1376
|
|
|
1359
1377
|
Built-in tools support pluggable operations for delegating to remote systems (SSH, containers, etc.):
|
|
1360
1378
|
|
|
1361
1379
|
```typescript
|
|
1362
|
-
import { createReadTool, createBashTool, type ReadOperations } from "@
|
|
1380
|
+
import { createReadTool, createBashTool, type ReadOperations } from "@draht/coding-agent";
|
|
1363
1381
|
|
|
1364
1382
|
// Create tool with custom operations
|
|
1365
1383
|
const remoteRead = createReadTool(cwd, {
|
|
@@ -1388,7 +1406,7 @@ pi.registerTool({
|
|
|
1388
1406
|
The bash tool also supports a spawn hook to adjust the command, cwd, or env before execution:
|
|
1389
1407
|
|
|
1390
1408
|
```typescript
|
|
1391
|
-
import { createBashTool } from "@
|
|
1409
|
+
import { createBashTool } from "@draht/coding-agent";
|
|
1392
1410
|
|
|
1393
1411
|
const bashTool = createBashTool(cwd, {
|
|
1394
1412
|
spawnHook: ({ command, cwd, env }) => ({
|
|
@@ -1418,7 +1436,7 @@ import {
|
|
|
1418
1436
|
formatSize, // Human-readable size (e.g., "50KB", "1.5MB")
|
|
1419
1437
|
DEFAULT_MAX_BYTES, // 50KB
|
|
1420
1438
|
DEFAULT_MAX_LINES, // 2000
|
|
1421
|
-
} from "@
|
|
1439
|
+
} from "@draht/coding-agent";
|
|
1422
1440
|
|
|
1423
1441
|
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
1424
1442
|
const output = await runCommand();
|
|
@@ -1473,7 +1491,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
1473
1491
|
|
|
1474
1492
|
### Custom Rendering
|
|
1475
1493
|
|
|
1476
|
-
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/
|
|
1494
|
+
Tools can provide `renderCall` and `renderResult` for custom TUI display. See [tui.md](tui.md) for the full component API and [tool-execution.ts](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/modes/interactive/components/tool-execution.ts) for how built-in tools render.
|
|
1477
1495
|
|
|
1478
1496
|
Tool output is wrapped in a `Box` that handles padding and background. Your render methods return `Component` instances (typically `Text`).
|
|
1479
1497
|
|
|
@@ -1482,7 +1500,7 @@ Tool output is wrapped in a `Box` that handles padding and background. Your rend
|
|
|
1482
1500
|
Renders the tool call (before/during execution):
|
|
1483
1501
|
|
|
1484
1502
|
```typescript
|
|
1485
|
-
import { Text } from "@
|
|
1503
|
+
import { Text } from "@draht/tui";
|
|
1486
1504
|
|
|
1487
1505
|
renderCall(args, theme) {
|
|
1488
1506
|
let text = theme.fg("toolTitle", theme.bold("my_tool "));
|
|
@@ -1526,7 +1544,7 @@ renderResult(result, { expanded, isPartial }, theme) {
|
|
|
1526
1544
|
Use `keyHint()` to display keybinding hints that respect user's keybinding configuration:
|
|
1527
1545
|
|
|
1528
1546
|
```typescript
|
|
1529
|
-
import { keyHint } from "@
|
|
1547
|
+
import { keyHint } from "@draht/coding-agent";
|
|
1530
1548
|
|
|
1531
1549
|
renderResult(result, { expanded }, theme) {
|
|
1532
1550
|
let text = theme.fg("success", "✓ Done");
|
|
@@ -1700,7 +1718,7 @@ ctx.ui.theme.fg("accent", "styled text"); // Access current theme
|
|
|
1700
1718
|
For complex UI, use `ctx.ui.custom()`. This temporarily replaces the editor with your component until `done()` is called:
|
|
1701
1719
|
|
|
1702
1720
|
```typescript
|
|
1703
|
-
import { Text, Component } from "@
|
|
1721
|
+
import { Text, Component } from "@draht/tui";
|
|
1704
1722
|
|
|
1705
1723
|
const result = await ctx.ui.custom<boolean>((tui, theme, keybindings, done) => {
|
|
1706
1724
|
const text = new Text("Press Enter to confirm, Escape to cancel", 1, 1);
|
|
@@ -1758,8 +1776,8 @@ See [tui.md](tui.md) for the full `OverlayOptions` API and [overlay-qa-tests.ts]
|
|
|
1758
1776
|
Replace the main input editor with a custom implementation (vim mode, emacs mode, etc.):
|
|
1759
1777
|
|
|
1760
1778
|
```typescript
|
|
1761
|
-
import { CustomEditor, type ExtensionAPI } from "@
|
|
1762
|
-
import { matchesKey } from "@
|
|
1779
|
+
import { CustomEditor, type ExtensionAPI } from "@draht/coding-agent";
|
|
1780
|
+
import { matchesKey } from "@draht/tui";
|
|
1763
1781
|
|
|
1764
1782
|
class VimEditor extends CustomEditor {
|
|
1765
1783
|
private mode: "normal" | "insert" = "insert";
|
|
@@ -1799,7 +1817,7 @@ See [tui.md](tui.md) Pattern 7 for a complete example with mode indicator.
|
|
|
1799
1817
|
Register a custom renderer for messages with your `customType`:
|
|
1800
1818
|
|
|
1801
1819
|
```typescript
|
|
1802
|
-
import { Text } from "@
|
|
1820
|
+
import { Text } from "@draht/tui";
|
|
1803
1821
|
|
|
1804
1822
|
pi.registerMessageRenderer("my-extension", (message, options, theme) => {
|
|
1805
1823
|
const { expanded } = options;
|
|
@@ -1848,7 +1866,7 @@ theme.strikethrough(text)
|
|
|
1848
1866
|
For syntax highlighting in custom tool renderers:
|
|
1849
1867
|
|
|
1850
1868
|
```typescript
|
|
1851
|
-
import { highlightCode, getLanguageFromPath } from "@
|
|
1869
|
+
import { highlightCode, getLanguageFromPath } from "@draht/coding-agent";
|
|
1852
1870
|
|
|
1853
1871
|
// Highlight code with explicit language
|
|
1854
1872
|
const highlighted = highlightCode("const x = 1;", "typescript", theme);
|
|
@@ -1886,6 +1904,7 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
1886
1904
|
| `question.ts` | Tool with user interaction | `registerTool`, `ui.select` |
|
|
1887
1905
|
| `questionnaire.ts` | Multi-step wizard tool | `registerTool`, `ui.custom` |
|
|
1888
1906
|
| `todo.ts` | Stateful tool with persistence | `registerTool`, `appendEntry`, `renderResult`, session events |
|
|
1907
|
+
| `dynamic-tools.ts` | Register tools after startup and during commands | `registerTool`, `session_start`, `registerCommand` |
|
|
1889
1908
|
| `truncated-tool.ts` | Output truncation example | `registerTool`, `truncateHead` |
|
|
1890
1909
|
| `tool-override.ts` | Override built-in read tool | `registerTool` (same name as built-in) |
|
|
1891
1910
|
| **Commands** |||
|
package/docs/json.md
CHANGED
|
@@ -8,7 +8,7 @@ Outputs all session events as JSON lines to stdout. Useful for integrating pi in
|
|
|
8
8
|
|
|
9
9
|
## Event Types
|
|
10
10
|
|
|
11
|
-
Events are defined in [`AgentSessionEvent`](https://github.com/
|
|
11
|
+
Events are defined in [`AgentSessionEvent`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/agent-session.ts#L102):
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
type AgentSessionEvent =
|
|
@@ -19,7 +19,7 @@ type AgentSessionEvent =
|
|
|
19
19
|
| { type: "auto_retry_end"; success: boolean; attempt: number; finalError?: string };
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Base events from [`AgentEvent`](https://github.com/
|
|
22
|
+
Base events from [`AgentEvent`](https://github.com/draht-dev/draht/blob/main/packages/agent/src/types.ts#L179):
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
25
|
type AgentEvent =
|
|
@@ -41,12 +41,12 @@ type AgentEvent =
|
|
|
41
41
|
|
|
42
42
|
## Message Types
|
|
43
43
|
|
|
44
|
-
Base messages from [`packages/ai/src/types.ts`](https://github.com/
|
|
44
|
+
Base messages from [`packages/ai/src/types.ts`](https://github.com/draht-dev/draht/blob/main/packages/ai/src/types.ts#L134):
|
|
45
45
|
- `UserMessage` (line 134)
|
|
46
46
|
- `AssistantMessage` (line 140)
|
|
47
47
|
- `ToolResultMessage` (line 152)
|
|
48
48
|
|
|
49
|
-
Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/
|
|
49
|
+
Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/messages.ts#L29):
|
|
50
50
|
- `BashExecutionMessage` (line 29)
|
|
51
51
|
- `CustomMessage` (line 46)
|
|
52
52
|
- `BranchSummaryMessage` (line 55)
|
package/docs/packages.md
CHANGED
|
@@ -149,7 +149,7 @@ If no `pi` manifest is present, pi auto-discovers resources from these directori
|
|
|
149
149
|
|
|
150
150
|
Third party runtime dependencies belong in `dependencies` in `package.json`. Dependencies that do not register extensions, skills, prompt templates, or themes also belong in `dependencies`. When pi installs a package from npm or git, it runs `npm install`, so those dependencies are installed automatically.
|
|
151
151
|
|
|
152
|
-
Pi bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@
|
|
152
|
+
Pi bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@draht/ai`, `@draht/agent-core-core`, `@draht/coding-agent`, `@draht/tui`, `@sinclair/typebox`.
|
|
153
153
|
|
|
154
154
|
Other pi packages must be bundled in your tarball. Add them to `dependencies` and `bundledDependencies`, then reference their resources through `node_modules/` paths. Pi loads packages with separate module roots, so separate installs do not collide or share modules.
|
|
155
155
|
|
package/docs/providers.md
CHANGED
|
@@ -65,12 +65,13 @@ pi
|
|
|
65
65
|
| Vercel AI Gateway | `AI_GATEWAY_API_KEY` | `vercel-ai-gateway` |
|
|
66
66
|
| ZAI | `ZAI_API_KEY` | `zai` |
|
|
67
67
|
| OpenCode Zen | `OPENCODE_API_KEY` | `opencode` |
|
|
68
|
+
| OpenCode Go | `OPENCODE_API_KEY` | `opencode-go` |
|
|
68
69
|
| Hugging Face | `HF_TOKEN` | `huggingface` |
|
|
69
70
|
| Kimi For Coding | `KIMI_API_KEY` | `kimi-coding` |
|
|
70
71
|
| MiniMax | `MINIMAX_API_KEY` | `minimax` |
|
|
71
72
|
| MiniMax (China) | `MINIMAX_CN_API_KEY` | `minimax-cn` |
|
|
72
73
|
|
|
73
|
-
Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/
|
|
74
|
+
Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/draht-dev/draht/blob/main/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/draht-dev/draht/blob/main/packages/ai/src/env-api-keys.ts).
|
|
74
75
|
|
|
75
76
|
#### Auth File
|
|
76
77
|
|
|
@@ -81,7 +82,8 @@ Store credentials in `~/.pi/agent/auth.json`:
|
|
|
81
82
|
"anthropic": { "type": "api_key", "key": "sk-ant-..." },
|
|
82
83
|
"openai": { "type": "api_key", "key": "sk-..." },
|
|
83
84
|
"google": { "type": "api_key", "key": "..." },
|
|
84
|
-
"opencode": { "type": "api_key", "key": "..." }
|
|
85
|
+
"opencode": { "type": "api_key", "key": "..." },
|
|
86
|
+
"opencode-go": { "type": "api_key", "key": "..." }
|
|
85
87
|
}
|
|
86
88
|
```
|
|
87
89
|
|
package/docs/rpc.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
RPC mode enables headless operation of the coding agent via a JSON protocol over stdin/stdout. This is useful for embedding the agent in other applications, IDEs, or custom UIs.
|
|
4
4
|
|
|
5
|
-
**Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@
|
|
5
|
+
**Note for Node.js/TypeScript users**: If you're building a Node.js application, consider using `AgentSession` directly from `@draht/coding-agent` instead of spawning a subprocess. See [`src/core/agent-session.ts`](../src/core/agent-session.ts) for the API. For a subprocess-based TypeScript client, see [`src/modes/rpc/rpc-client.ts`](../src/modes/rpc/rpc-client.ts).
|
|
6
6
|
|
|
7
7
|
## Starting RPC Mode
|
|
8
8
|
|
package/docs/sdk.md
CHANGED
|
@@ -16,7 +16,7 @@ See [examples/sdk/](../examples/sdk/) for working examples from minimal to full
|
|
|
16
16
|
## Quick Start
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
|
-
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@
|
|
19
|
+
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@draht/coding-agent";
|
|
20
20
|
|
|
21
21
|
// Set up credential storage and model registry
|
|
22
22
|
const authStorage = AuthStorage.create();
|
|
@@ -40,7 +40,7 @@ await session.prompt("What files are in the current directory?");
|
|
|
40
40
|
## Installation
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
npm install @
|
|
43
|
+
npm install @draht/coding-agent
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
The SDK is included in the main package. No separate installation needed.
|
|
@@ -54,7 +54,7 @@ The main factory function. Creates an `AgentSession` with configurable options.
|
|
|
54
54
|
`createAgentSession()` uses a `ResourceLoader` to supply extensions, skills, prompt templates, themes, and context files. If you do not provide one, it uses `DefaultResourceLoader` with standard discovery.
|
|
55
55
|
|
|
56
56
|
```typescript
|
|
57
|
-
import { createAgentSession } from "@
|
|
57
|
+
import { createAgentSession } from "@draht/coding-agent";
|
|
58
58
|
|
|
59
59
|
// Minimal: defaults with DefaultResourceLoader
|
|
60
60
|
const { session } = await createAgentSession();
|
|
@@ -161,7 +161,7 @@ Both `steer()` and `followUp()` expand file-based prompt templates but error on
|
|
|
161
161
|
|
|
162
162
|
### Agent and AgentState
|
|
163
163
|
|
|
164
|
-
The `Agent` class (from `@
|
|
164
|
+
The `Agent` class (from `@draht/agent-core-core`) handles the core LLM interaction. Access it via `session.agent`.
|
|
165
165
|
|
|
166
166
|
```typescript
|
|
167
167
|
// Access current state
|
|
@@ -282,8 +282,8 @@ When you pass a custom `ResourceLoader`, `cwd` and `agentDir` no longer control
|
|
|
282
282
|
### Model
|
|
283
283
|
|
|
284
284
|
```typescript
|
|
285
|
-
import { getModel } from "@
|
|
286
|
-
import { AuthStorage, ModelRegistry } from "@
|
|
285
|
+
import { getModel } from "@draht/ai";
|
|
286
|
+
import { AuthStorage, ModelRegistry } from "@draht/coding-agent";
|
|
287
287
|
|
|
288
288
|
const authStorage = AuthStorage.create();
|
|
289
289
|
const modelRegistry = new ModelRegistry(authStorage);
|
|
@@ -330,7 +330,7 @@ API key resolution priority (handled by AuthStorage):
|
|
|
330
330
|
4. Fallback resolver (for custom provider keys from `models.json`)
|
|
331
331
|
|
|
332
332
|
```typescript
|
|
333
|
-
import { AuthStorage, ModelRegistry } from "@
|
|
333
|
+
import { AuthStorage, ModelRegistry } from "@draht/coding-agent";
|
|
334
334
|
|
|
335
335
|
// Default: uses ~/.pi/agent/auth.json and ~/.pi/agent/models.json
|
|
336
336
|
const authStorage = AuthStorage.create();
|
|
@@ -366,7 +366,7 @@ const simpleRegistry = new ModelRegistry(authStorage);
|
|
|
366
366
|
Use a `ResourceLoader` to override the system prompt:
|
|
367
367
|
|
|
368
368
|
```typescript
|
|
369
|
-
import { createAgentSession, DefaultResourceLoader } from "@
|
|
369
|
+
import { createAgentSession, DefaultResourceLoader } from "@draht/coding-agent";
|
|
370
370
|
|
|
371
371
|
const loader = new DefaultResourceLoader({
|
|
372
372
|
systemPromptOverride: () => "You are a helpful assistant.",
|
|
@@ -386,7 +386,7 @@ import {
|
|
|
386
386
|
readOnlyTools, // read, grep, find, ls
|
|
387
387
|
readTool, bashTool, editTool, writeTool,
|
|
388
388
|
grepTool, findTool, lsTool,
|
|
389
|
-
} from "@
|
|
389
|
+
} from "@draht/coding-agent";
|
|
390
390
|
|
|
391
391
|
// Use built-in tool set
|
|
392
392
|
const { session } = await createAgentSession({
|
|
@@ -414,7 +414,7 @@ import {
|
|
|
414
414
|
createGrepTool,
|
|
415
415
|
createFindTool,
|
|
416
416
|
createLsTool,
|
|
417
|
-
} from "@
|
|
417
|
+
} from "@draht/coding-agent";
|
|
418
418
|
|
|
419
419
|
const cwd = "/path/to/project";
|
|
420
420
|
|
|
@@ -444,7 +444,7 @@ const { session } = await createAgentSession({
|
|
|
444
444
|
|
|
445
445
|
```typescript
|
|
446
446
|
import { Type } from "@sinclair/typebox";
|
|
447
|
-
import { createAgentSession, type ToolDefinition } from "@
|
|
447
|
+
import { createAgentSession, type ToolDefinition } from "@draht/coding-agent";
|
|
448
448
|
|
|
449
449
|
// Inline custom tool
|
|
450
450
|
const myTool: ToolDefinition = {
|
|
@@ -475,7 +475,7 @@ Custom tools passed via `customTools` are combined with extension-registered too
|
|
|
475
475
|
Extensions are loaded by the `ResourceLoader`. `DefaultResourceLoader` discovers extensions from `~/.pi/agent/extensions/`, `.pi/extensions/`, and settings.json extension sources.
|
|
476
476
|
|
|
477
477
|
```typescript
|
|
478
|
-
import { createAgentSession, DefaultResourceLoader } from "@
|
|
478
|
+
import { createAgentSession, DefaultResourceLoader } from "@draht/coding-agent";
|
|
479
479
|
|
|
480
480
|
const loader = new DefaultResourceLoader({
|
|
481
481
|
additionalExtensionPaths: ["/path/to/my-extension.ts"],
|
|
@@ -497,7 +497,7 @@ Extensions can register tools, subscribe to events, add commands, and more. See
|
|
|
497
497
|
**Event Bus:** Extensions can communicate via `pi.events`. Pass a shared `eventBus` to `DefaultResourceLoader` if you need to emit or listen from outside:
|
|
498
498
|
|
|
499
499
|
```typescript
|
|
500
|
-
import { createEventBus, DefaultResourceLoader } from "@
|
|
500
|
+
import { createEventBus, DefaultResourceLoader } from "@draht/coding-agent";
|
|
501
501
|
|
|
502
502
|
const eventBus = createEventBus();
|
|
503
503
|
const loader = new DefaultResourceLoader({
|
|
@@ -517,7 +517,7 @@ import {
|
|
|
517
517
|
createAgentSession,
|
|
518
518
|
DefaultResourceLoader,
|
|
519
519
|
type Skill,
|
|
520
|
-
} from "@
|
|
520
|
+
} from "@draht/coding-agent";
|
|
521
521
|
|
|
522
522
|
const customSkill: Skill = {
|
|
523
523
|
name: "my-skill",
|
|
@@ -543,7 +543,7 @@ const { session } = await createAgentSession({ resourceLoader: loader });
|
|
|
543
543
|
### Context Files
|
|
544
544
|
|
|
545
545
|
```typescript
|
|
546
|
-
import { createAgentSession, DefaultResourceLoader } from "@
|
|
546
|
+
import { createAgentSession, DefaultResourceLoader } from "@draht/coding-agent";
|
|
547
547
|
|
|
548
548
|
const loader = new DefaultResourceLoader({
|
|
549
549
|
agentsFilesOverride: (current) => ({
|
|
@@ -567,7 +567,7 @@ import {
|
|
|
567
567
|
createAgentSession,
|
|
568
568
|
DefaultResourceLoader,
|
|
569
569
|
type PromptTemplate,
|
|
570
|
-
} from "@
|
|
570
|
+
} from "@draht/coding-agent";
|
|
571
571
|
|
|
572
572
|
const customCommand: PromptTemplate = {
|
|
573
573
|
name: "deploy",
|
|
@@ -594,7 +594,7 @@ const { session } = await createAgentSession({ resourceLoader: loader });
|
|
|
594
594
|
Sessions use a tree structure with `id`/`parentId` linking, enabling in-place branching.
|
|
595
595
|
|
|
596
596
|
```typescript
|
|
597
|
-
import { createAgentSession, SessionManager } from "@
|
|
597
|
+
import { createAgentSession, SessionManager } from "@draht/coding-agent";
|
|
598
598
|
|
|
599
599
|
// In-memory (no persistence)
|
|
600
600
|
const { session } = await createAgentSession({
|
|
@@ -665,7 +665,7 @@ sm.createBranchedSession(leafId); // Extract path to new file
|
|
|
665
665
|
### Settings Management
|
|
666
666
|
|
|
667
667
|
```typescript
|
|
668
|
-
import { createAgentSession, SettingsManager, SessionManager } from "@
|
|
668
|
+
import { createAgentSession, SettingsManager, SessionManager } from "@draht/coding-agent";
|
|
669
669
|
|
|
670
670
|
// Default: loads from files (global + project merged)
|
|
671
671
|
const { session } = await createAgentSession({
|
|
@@ -721,7 +721,7 @@ Use `DefaultResourceLoader` to discover extensions, skills, prompts, themes, and
|
|
|
721
721
|
import {
|
|
722
722
|
DefaultResourceLoader,
|
|
723
723
|
getAgentDir,
|
|
724
|
-
} from "@
|
|
724
|
+
} from "@draht/coding-agent";
|
|
725
725
|
|
|
726
726
|
const loader = new DefaultResourceLoader({
|
|
727
727
|
cwd,
|
|
@@ -762,7 +762,7 @@ interface LoadExtensionsResult {
|
|
|
762
762
|
## Complete Example
|
|
763
763
|
|
|
764
764
|
```typescript
|
|
765
|
-
import { getModel } from "@
|
|
765
|
+
import { getModel } from "@draht/ai";
|
|
766
766
|
import { Type } from "@sinclair/typebox";
|
|
767
767
|
import {
|
|
768
768
|
AuthStorage,
|
|
@@ -774,7 +774,7 @@ import {
|
|
|
774
774
|
readTool,
|
|
775
775
|
bashTool,
|
|
776
776
|
type ToolDefinition,
|
|
777
|
-
} from "@
|
|
777
|
+
} from "@draht/coding-agent";
|
|
778
778
|
|
|
779
779
|
// Set up auth storage (custom location)
|
|
780
780
|
const authStorage = AuthStorage.create("/custom/agent/auth.json");
|
|
@@ -851,7 +851,7 @@ The SDK exports run mode utilities for building custom interfaces on top of `cre
|
|
|
851
851
|
Full TUI interactive mode with editor, chat history, and all built-in commands:
|
|
852
852
|
|
|
853
853
|
```typescript
|
|
854
|
-
import { createAgentSession, InteractiveMode } from "@
|
|
854
|
+
import { createAgentSession, InteractiveMode } from "@draht/coding-agent";
|
|
855
855
|
|
|
856
856
|
const { session } = await createAgentSession({ /* ... */ });
|
|
857
857
|
|
|
@@ -872,7 +872,7 @@ await mode.run(); // Blocks until exit
|
|
|
872
872
|
Single-shot mode: send prompts, output result, exit:
|
|
873
873
|
|
|
874
874
|
```typescript
|
|
875
|
-
import { createAgentSession, runPrintMode } from "@
|
|
875
|
+
import { createAgentSession, runPrintMode } from "@draht/coding-agent";
|
|
876
876
|
|
|
877
877
|
const { session } = await createAgentSession({ /* ... */ });
|
|
878
878
|
|
|
@@ -889,7 +889,7 @@ await runPrintMode(session, {
|
|
|
889
889
|
JSON-RPC mode for subprocess integration:
|
|
890
890
|
|
|
891
891
|
```typescript
|
|
892
|
-
import { createAgentSession, runRpcMode } from "@
|
|
892
|
+
import { createAgentSession, runRpcMode } from "@draht/coding-agent";
|
|
893
893
|
|
|
894
894
|
const { session } = await createAgentSession({ /* ... */ });
|
|
895
895
|
|
package/docs/session.md
CHANGED
|
@@ -28,13 +28,13 @@ Existing sessions are automatically migrated to the current version (v3) when lo
|
|
|
28
28
|
|
|
29
29
|
## Source Files
|
|
30
30
|
|
|
31
|
-
Source on GitHub ([pi-mono](https://github.com/
|
|
32
|
-
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/
|
|
33
|
-
- [`packages/coding-agent/src/core/messages.ts`](https://github.com/
|
|
34
|
-
- [`packages/ai/src/types.ts`](https://github.com/
|
|
35
|
-
- [`packages/agent/src/types.ts`](https://github.com/
|
|
31
|
+
Source on GitHub ([pi-mono](https://github.com/draht-dev/draht)):
|
|
32
|
+
- [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
|
|
33
|
+
- [`packages/coding-agent/src/core/messages.ts`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
|
|
34
|
+
- [`packages/ai/src/types.ts`](https://github.com/draht-dev/draht/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
|
|
35
|
+
- [`packages/agent/src/types.ts`](https://github.com/draht-dev/draht/blob/main/packages/agent/src/types.ts) - AgentMessage union type
|
|
36
36
|
|
|
37
|
-
For TypeScript definitions in your project, inspect `node_modules/@
|
|
37
|
+
For TypeScript definitions in your project, inspect `node_modules/@draht/coding-agent/dist/` and `node_modules/@draht/ai/dist/`.
|
|
38
38
|
|
|
39
39
|
## Message Types
|
|
40
40
|
|
package/docs/settings.md
CHANGED
|
@@ -69,6 +69,7 @@ Edit directly or use `/settings` for common options.
|
|
|
69
69
|
| Setting | Type | Default | Description |
|
|
70
70
|
|---------|------|---------|-------------|
|
|
71
71
|
| `branchSummary.reserveTokens` | number | `16384` | Tokens reserved for branch summarization |
|
|
72
|
+
| `branchSummary.skipPrompt` | boolean | `false` | Skip "Summarize branch?" prompt on `/tree` navigation (defaults to no summary) |
|
|
72
73
|
|
|
73
74
|
### Retry
|
|
74
75
|
|
package/docs/termux.md
CHANGED
package/docs/themes.md
CHANGED
|
@@ -52,7 +52,7 @@ vim ~/.pi/agent/themes/my-theme.json
|
|
|
52
52
|
|
|
53
53
|
```json
|
|
54
54
|
{
|
|
55
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
55
|
+
"$schema": "https://raw.githubusercontent.com/draht-dev/draht/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
56
56
|
"name": "my-theme",
|
|
57
57
|
"vars": {
|
|
58
58
|
"primary": "#00aaff",
|
|
@@ -122,7 +122,7 @@ vim ~/.pi/agent/themes/my-theme.json
|
|
|
122
122
|
|
|
123
123
|
```json
|
|
124
124
|
{
|
|
125
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
125
|
+
"$schema": "https://raw.githubusercontent.com/draht-dev/draht/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
126
126
|
"name": "my-theme",
|
|
127
127
|
"vars": {
|
|
128
128
|
"blue": "#0066cc",
|