@draht/coding-agent 2026.3.25 → 2026.4.23
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 +896 -624
- package/README.md +110 -97
- package/dist/cli/args.d.ts +7 -10
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +42 -44
- package/dist/cli/args.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +18 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +83 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +236 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +86 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +116 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +17 -47
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +166 -291
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +3 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +5 -2
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +19 -7
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +2 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +3 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +27 -26
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts +2 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js +2 -2
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -2
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +7 -7
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +4 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +30 -29
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js +10 -0
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +5 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +70 -8
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +14 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +13 -14
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-registry.d.ts +21 -3
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +120 -71
- 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 +4 -4
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-manager.d.ts +21 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +108 -43
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +1 -22
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +6 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +37 -5
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +25 -3
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +7 -4
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +18 -24
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-manager.d.ts +5 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +16 -8
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +5 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +3 -3
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +6 -6
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/timings.d.ts +1 -0
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +6 -0
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +19 -9
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +23 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +150 -57
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts +13 -11
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +55 -77
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js +4 -4
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/index.d.ts +9 -6
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +2 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +259 -422
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +3 -3
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +25 -5
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +3 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +14 -3
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.js +40 -0
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +1 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +4 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +2 -7
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +4 -2
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +48 -15
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +18 -5
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +287 -188
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +15 -11
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts +2 -2
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +89 -72
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +1 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +2 -2
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +95 -64
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/package-manager-cli.d.ts +4 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +234 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/prompts/commands/atomic-commit.md +17 -0
- package/dist/prompts/commands/discuss-phase.md +15 -0
- package/dist/prompts/commands/execute-phase.md +14 -0
- package/dist/prompts/commands/fix.md +14 -0
- package/dist/prompts/commands/init-project.md +16 -0
- package/dist/prompts/commands/map-codebase.md +16 -0
- package/dist/prompts/commands/new-project.md +16 -0
- package/dist/prompts/commands/next-milestone.md +16 -0
- package/dist/prompts/commands/pause-work.md +13 -0
- package/dist/prompts/commands/plan-phase.md +15 -0
- package/dist/prompts/commands/progress.md +13 -0
- package/dist/prompts/commands/quick.md +14 -0
- package/dist/prompts/commands/resume-work.md +13 -0
- package/dist/prompts/commands/review.md +15 -0
- package/dist/prompts/commands/verify-work.md +15 -0
- package/dist/utils/paths.d.ts +7 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +19 -0
- package/dist/utils/paths.js.map +1 -0
- package/docs/compaction.md +5 -3
- package/docs/custom-provider.md +1 -1
- package/docs/development.md +5 -3
- package/docs/extensions.md +221 -69
- package/docs/json.md +5 -2
- package/docs/keybindings.md +2 -0
- package/docs/models.md +60 -3
- package/docs/packages.md +3 -3
- package/docs/rpc.md +23 -9
- package/docs/sdk.md +240 -84
- package/docs/session.md +3 -3
- package/docs/settings.md +12 -0
- package/docs/skills.md +3 -2
- package/docs/tree.md +6 -3
- package/examples/README.md +1 -1
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/antigravity-image-gen.ts +1 -1
- package/examples/extensions/custom-compaction.ts +17 -4
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +1 -1
- package/examples/extensions/doom-overlay/doom/build.sh +2 -2
- package/examples/extensions/handoff.ts +5 -2
- package/examples/extensions/hello.ts +18 -17
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/overlay-qa-tests.ts +2 -2
- package/examples/extensions/qna.ts +5 -2
- package/examples/extensions/rpc-demo.ts +3 -9
- package/examples/extensions/sandbox/index.ts +8 -4
- package/examples/extensions/status-line.ts +0 -8
- package/examples/extensions/subagent/index.ts +6 -6
- package/examples/extensions/summarize.ts +15 -4
- package/examples/extensions/todo.ts +0 -2
- package/examples/extensions/tools.ts +0 -5
- package/examples/extensions/trigger-compact.ts +11 -1
- package/examples/extensions/widget-placement.ts +4 -12
- package/examples/sdk/02-custom-model.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +3 -3
- package/examples/sdk/12-full-control.ts +1 -1
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +8 -5
- package/package.json +7 -8
- package/prompts/commands/atomic-commit.md +17 -0
- package/prompts/commands/discuss-phase.md +15 -0
- package/prompts/commands/execute-phase.md +14 -0
- package/prompts/commands/fix.md +14 -0
- package/prompts/commands/init-project.md +16 -0
- package/prompts/commands/map-codebase.md +16 -0
- package/prompts/commands/new-project.md +16 -0
- package/prompts/commands/next-milestone.md +16 -0
- package/prompts/commands/pause-work.md +13 -0
- package/prompts/commands/plan-phase.md +15 -0
- package/prompts/commands/progress.md +13 -0
- package/prompts/commands/quick.md +14 -0
- package/prompts/commands/resume-work.md +13 -0
- package/prompts/commands/review.md +15 -0
- package/prompts/commands/verify-work.md +15 -0
|
@@ -48,7 +48,7 @@ type SaveMode = (typeof SAVE_MODES)[number];
|
|
|
48
48
|
|
|
49
49
|
const ANTIGRAVITY_ENDPOINT = "https://daily-cloudcode-pa.sandbox.googleapis.com";
|
|
50
50
|
|
|
51
|
-
const DEFAULT_ANTIGRAVITY_VERSION = "1.
|
|
51
|
+
const DEFAULT_ANTIGRAVITY_VERSION = "1.21.9";
|
|
52
52
|
|
|
53
53
|
const ANTIGRAVITY_HEADERS = {
|
|
54
54
|
"User-Agent": `antigravity/${process.env.PI_AI_ANTIGRAVITY_VERSION || DEFAULT_ANTIGRAVITY_VERSION} darwin/arm64`,
|
|
@@ -31,9 +31,13 @@ export default function (pi: ExtensionAPI) {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
// Resolve
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
34
|
+
// Resolve request auth for the summarization model
|
|
35
|
+
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(model);
|
|
36
|
+
if (!auth.ok) {
|
|
37
|
+
ctx.ui.notify(`Compaction auth failed: ${auth.error}`, "warning");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (!auth.apiKey) {
|
|
37
41
|
ctx.ui.notify(`No API key for ${model.provider}, using default compaction`, "warning");
|
|
38
42
|
return;
|
|
39
43
|
}
|
|
@@ -83,7 +87,16 @@ ${conversationText}
|
|
|
83
87
|
|
|
84
88
|
try {
|
|
85
89
|
// Pass signal to honor abort requests (e.g., user cancels compaction)
|
|
86
|
-
const response = await complete(
|
|
90
|
+
const response = await complete(
|
|
91
|
+
model,
|
|
92
|
+
{ messages: summaryMessages },
|
|
93
|
+
{
|
|
94
|
+
apiKey: auth.apiKey,
|
|
95
|
+
headers: auth.headers,
|
|
96
|
+
maxTokens: 8192,
|
|
97
|
+
signal,
|
|
98
|
+
},
|
|
99
|
+
);
|
|
87
100
|
|
|
88
101
|
const summary = response.content
|
|
89
102
|
.filter((c): c is { type: "text"; text: string } => c.type === "text")
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* GitLab Duo Provider Extension
|
|
3
3
|
*
|
|
4
4
|
* Provides access to GitLab Duo AI models (Claude and GPT) through GitLab's AI Gateway.
|
|
5
|
-
* Delegates to
|
|
5
|
+
* Delegates to @draht/ai's built-in Anthropic and OpenAI streaming implementations.
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
8
|
* pi -e ./packages/coding-agent/examples/extensions/custom-provider-gitlab-duo
|
|
@@ -80,7 +80,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
80
80
|
loader.onAbort = () => done(null);
|
|
81
81
|
|
|
82
82
|
const doGenerate = async () => {
|
|
83
|
-
const
|
|
83
|
+
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(ctx.model!);
|
|
84
|
+
if (!auth.ok || !auth.apiKey) {
|
|
85
|
+
throw new Error(auth.ok ? `No API key for ${ctx.model!.provider}` : auth.error);
|
|
86
|
+
}
|
|
84
87
|
|
|
85
88
|
const userMessage: Message = {
|
|
86
89
|
role: "user",
|
|
@@ -96,7 +99,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
96
99
|
const response = await complete(
|
|
97
100
|
ctx.model!,
|
|
98
101
|
{ systemPrompt: SYSTEM_PROMPT, messages: [userMessage] },
|
|
99
|
-
{ apiKey, signal: loader.signal },
|
|
102
|
+
{ apiKey: auth.apiKey, headers: auth.headers, signal: loader.signal },
|
|
100
103
|
);
|
|
101
104
|
|
|
102
105
|
if (response.stopReason === "aborted") {
|
|
@@ -3,23 +3,24 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { Type } from "@draht/ai";
|
|
6
|
-
import type
|
|
6
|
+
import { defineTool, type ExtensionAPI } from "@draht/coding-agent";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
const helloTool = defineTool({
|
|
9
|
+
name: "hello",
|
|
10
|
+
label: "Hello",
|
|
11
|
+
description: "A simple greeting tool",
|
|
12
|
+
parameters: Type.Object({
|
|
13
|
+
name: Type.String({ description: "Name to greet" }),
|
|
14
|
+
}),
|
|
15
|
+
|
|
16
|
+
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
17
|
+
return {
|
|
18
|
+
content: [{ type: "text", text: `Hello, ${params.name}!` }],
|
|
19
|
+
details: { greeted: params.name },
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
});
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
content: [{ type: "text", text: `Hello, ${name}!` }],
|
|
21
|
-
details: { greeted: name },
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
});
|
|
24
|
+
export default function (pi: ExtensionAPI) {
|
|
25
|
+
pi.registerTool(helloTool);
|
|
25
26
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hidden Thinking Label Extension
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates `ctx.ui.setHiddenThinkingLabel()` for customizing the label shown
|
|
5
|
+
* when thinking blocks are hidden.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* pi --extension examples/extensions/hidden-thinking-label.ts
|
|
9
|
+
*
|
|
10
|
+
* Test:
|
|
11
|
+
* 1. Load this extension
|
|
12
|
+
* 2. Hide thinking blocks with Ctrl+T
|
|
13
|
+
* 3. Ask for something that produces reasoning output
|
|
14
|
+
* 4. The collapsed thinking block label will show the custom text
|
|
15
|
+
*
|
|
16
|
+
* Commands:
|
|
17
|
+
* /thinking-label <text> Set a custom hidden thinking label
|
|
18
|
+
* /thinking-label Reset to the default label
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import type { ExtensionAPI, ExtensionContext } from "@draht/coding-agent";
|
|
22
|
+
|
|
23
|
+
const DEFAULT_LABEL = "Pondering...";
|
|
24
|
+
|
|
25
|
+
export default function (pi: ExtensionAPI) {
|
|
26
|
+
let label = DEFAULT_LABEL;
|
|
27
|
+
|
|
28
|
+
const applyLabel = (ctx: ExtensionContext) => {
|
|
29
|
+
ctx.ui.setHiddenThinkingLabel(label);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
33
|
+
applyLabel(ctx);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
pi.registerCommand("thinking-label", {
|
|
37
|
+
description: "Set the hidden thinking label. Use without args to reset.",
|
|
38
|
+
handler: async (args, ctx) => {
|
|
39
|
+
const nextLabel = args.trim();
|
|
40
|
+
|
|
41
|
+
if (!nextLabel) {
|
|
42
|
+
label = DEFAULT_LABEL;
|
|
43
|
+
ctx.ui.setHiddenThinkingLabel();
|
|
44
|
+
ctx.ui.notify(`Hidden thinking label reset to: ${DEFAULT_LABEL}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
label = nextLabel;
|
|
49
|
+
ctx.ui.setHiddenThinkingLabel(label);
|
|
50
|
+
ctx.ui.notify(`Hidden thinking label set to: ${label}`);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -473,13 +473,13 @@ class StreamingOverflowComponent extends BaseOverlay {
|
|
|
473
473
|
echo ""
|
|
474
474
|
for i in $(seq 1 100); do
|
|
475
475
|
# Simulate long file paths with OSC 8 hyperlinks (clickable) - tests width overflow
|
|
476
|
-
DIR="/Users/nicobailon/Documents/development/
|
|
476
|
+
DIR="/Users/nicobailon/Documents/development/draht-mono/packages/coding-agent/src/modes/interactive"
|
|
477
477
|
FILE="\${DIR}/components/very-long-component-name-that-exceeds-width-\${i}.ts"
|
|
478
478
|
echo -e "\\033]8;;file://\${FILE}\\007▶ read: \${FILE}\\033]8;;\\007"
|
|
479
479
|
|
|
480
480
|
# Add some colored status messages with long text
|
|
481
481
|
if [ $((i % 5)) -eq 0 ]; then
|
|
482
|
-
echo -e " \\033[32m✓ Successfully processed \${i} files in /Users/nicobailon/Documents/development/
|
|
482
|
+
echo -e " \\033[32m✓ Successfully processed \${i} files in /Users/nicobailon/Documents/development/draht-mono\\033[0m"
|
|
483
483
|
fi
|
|
484
484
|
if [ $((i % 7)) -eq 0 ]; then
|
|
485
485
|
echo -e " \\033[33m⚠ Warning: potential issue detected at line \${i} in very-long-component-name-that-exceeds-width.ts\\033[0m"
|
|
@@ -77,7 +77,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
77
77
|
|
|
78
78
|
// Do the work
|
|
79
79
|
const doExtract = async () => {
|
|
80
|
-
const
|
|
80
|
+
const auth = await ctx.modelRegistry.getApiKeyAndHeaders(ctx.model!);
|
|
81
|
+
if (!auth.ok || !auth.apiKey) {
|
|
82
|
+
throw new Error(auth.ok ? `No API key for ${ctx.model!.provider}` : auth.error);
|
|
83
|
+
}
|
|
81
84
|
const userMessage: UserMessage = {
|
|
82
85
|
role: "user",
|
|
83
86
|
content: [{ type: "text", text: lastAssistantText! }],
|
|
@@ -87,7 +90,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
87
90
|
const response = await complete(
|
|
88
91
|
ctx.model!,
|
|
89
92
|
{ systemPrompt: SYSTEM_PROMPT, messages: [userMessage] },
|
|
90
|
-
{ apiKey, signal: loader.signal },
|
|
93
|
+
{ apiKey: auth.apiKey, headers: auth.headers, signal: loader.signal },
|
|
91
94
|
);
|
|
92
95
|
|
|
93
96
|
if (response.stopReason === "aborted") {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* - notify() - after each dialog completes
|
|
14
14
|
* - setStatus() - on turn_start/turn_end
|
|
15
15
|
* - setWidget() - on session_start
|
|
16
|
-
* - setTitle() - on session_start
|
|
16
|
+
* - setTitle() - on session_start
|
|
17
17
|
* - setEditorText() - via /rpc-prefill command
|
|
18
18
|
*/
|
|
19
19
|
|
|
@@ -24,18 +24,12 @@ export default function (pi: ExtensionAPI) {
|
|
|
24
24
|
|
|
25
25
|
// -- setTitle, setWidget, setStatus on session lifecycle --
|
|
26
26
|
|
|
27
|
-
pi.on("session_start", async (
|
|
28
|
-
ctx.ui.setTitle("pi RPC Demo");
|
|
27
|
+
pi.on("session_start", async (event, ctx) => {
|
|
28
|
+
ctx.ui.setTitle(event.reason === "new" ? "pi RPC Demo (new session)" : "pi RPC Demo");
|
|
29
29
|
ctx.ui.setWidget("rpc-demo", ["--- RPC Extension UI Demo ---", "Loaded and ready."]);
|
|
30
30
|
ctx.ui.setStatus("rpc-demo", `Turns: ${turnCount}`);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
pi.on("session_switch", async (_event, ctx) => {
|
|
34
|
-
turnCount = 0;
|
|
35
|
-
ctx.ui.setTitle("pi RPC Demo (new session)");
|
|
36
|
-
ctx.ui.setStatus("rpc-demo", `Turns: ${turnCount}`);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
33
|
// -- setStatus on turn lifecycle --
|
|
40
34
|
|
|
41
35
|
pi.on("turn_start", async (_event, ctx) => {
|
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
* restrictions on bash commands at the OS level (sandbox-exec on macOS,
|
|
6
6
|
* bubblewrap on Linux).
|
|
7
7
|
*
|
|
8
|
+
* Note: this example intentionally overrides the built-in `bash` tool to show
|
|
9
|
+
* how built-in tools can be replaced. Alternatively, you could sandbox `bash`
|
|
10
|
+
* via `tool_call` input mutation without replacing the tool.
|
|
11
|
+
*
|
|
8
12
|
* Config files (merged, project takes precedence):
|
|
9
|
-
* - ~/.
|
|
10
|
-
* - <cwd>/.
|
|
13
|
+
* - ~/.draht/agent/extensions/sandbox.json (global)
|
|
14
|
+
* - <cwd>/.draht/sandbox.json (project-local)
|
|
11
15
|
*
|
|
12
16
|
* Example .pi/sandbox.json:
|
|
13
17
|
* ```json
|
|
@@ -31,8 +35,8 @@
|
|
|
31
35
|
* - `/sandbox` - show current sandbox configuration
|
|
32
36
|
*
|
|
33
37
|
* Setup:
|
|
34
|
-
* 1. Copy sandbox/ directory to ~/.
|
|
35
|
-
* 2. Run `npm install` in ~/.
|
|
38
|
+
* 1. Copy sandbox/ directory to ~/.draht/agent/extensions/
|
|
39
|
+
* 2. Run `npm install` in ~/.draht/agent/extensions/sandbox/
|
|
36
40
|
*
|
|
37
41
|
* Linux also requires: bubblewrap, socat, ripgrep
|
|
38
42
|
*/
|
|
@@ -29,12 +29,4 @@ export default function (pi: ExtensionAPI) {
|
|
|
29
29
|
const text = theme.fg("dim", ` Turn ${turnCount} complete`);
|
|
30
30
|
ctx.ui.setStatus("status-demo", check + text);
|
|
31
31
|
});
|
|
32
|
-
|
|
33
|
-
pi.on("session_switch", async (event, ctx) => {
|
|
34
|
-
if (event.reason === "new") {
|
|
35
|
-
turnCount = 0;
|
|
36
|
-
const theme = ctx.ui.theme;
|
|
37
|
-
ctx.ui.setStatus("status-demo", theme.fg("dim", "Ready"));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
32
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Subagent Tool - Delegate tasks to specialized agents
|
|
3
3
|
*
|
|
4
|
-
* Spawns a separate `
|
|
4
|
+
* Spawns a separate `draht` process for each subagent invocation,
|
|
5
5
|
* giving it an isolated context window.
|
|
6
6
|
*
|
|
7
7
|
* Supports three modes:
|
|
@@ -16,7 +16,7 @@ import { spawn } from "node:child_process";
|
|
|
16
16
|
import * as fs from "node:fs";
|
|
17
17
|
import * as os from "node:os";
|
|
18
18
|
import * as path from "node:path";
|
|
19
|
-
import type { AgentToolResult } from "@draht/agent
|
|
19
|
+
import type { AgentToolResult } from "@draht/agent";
|
|
20
20
|
import type { Message } from "@draht/ai";
|
|
21
21
|
import { StringEnum } from "@draht/ai";
|
|
22
22
|
import { type ExtensionAPI, getMarkdownTheme, withFileMutationQueue } from "@draht/coding-agent";
|
|
@@ -208,7 +208,7 @@ async function mapWithConcurrencyLimit<TIn, TOut>(
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
async function writePromptToTempFile(agentName: string, prompt: string): Promise<{ dir: string; filePath: string }> {
|
|
211
|
-
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "
|
|
211
|
+
const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "draht-subagent-"));
|
|
212
212
|
const safeName = agentName.replace(/[^\w.-]+/g, "_");
|
|
213
213
|
const filePath = path.join(tmpDir, `prompt-${safeName}.md`);
|
|
214
214
|
await withFileMutationQueue(filePath, async () => {
|
|
@@ -229,7 +229,7 @@ function getPiInvocation(args: string[]): { command: string; args: string[] } {
|
|
|
229
229
|
return { command: process.execPath, args };
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
-
return { command: "
|
|
232
|
+
return { command: "draht", args };
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
type OnUpdateCallback = (partial: AgentToolResult<SubagentDetails>) => void;
|
|
@@ -434,8 +434,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
434
434
|
description: [
|
|
435
435
|
"Delegate tasks to specialized subagents with isolated context.",
|
|
436
436
|
"Modes: single (agent + task), parallel (tasks array), chain (sequential with {previous} placeholder).",
|
|
437
|
-
'Default agent scope is "user" (from ~/.
|
|
438
|
-
'To enable project-local agents in .
|
|
437
|
+
'Default agent scope is "user" (from ~/.draht/agent/agents).',
|
|
438
|
+
'To enable project-local agents in .draht/agents, set agentScope: "both" (or "project").',
|
|
439
439
|
].join(" "),
|
|
440
440
|
parameters: SubagentParams,
|
|
441
441
|
|
|
@@ -165,12 +165,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
165
165
|
ctx.ui.notify("Model openai/gpt-5.2 not found", "warning");
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
const
|
|
169
|
-
if (!
|
|
168
|
+
const auth = model ? await ctx.modelRegistry.getApiKeyAndHeaders(model) : undefined;
|
|
169
|
+
if (auth && !auth.ok && ctx.hasUI) {
|
|
170
|
+
ctx.ui.notify(auth.error, "warning");
|
|
171
|
+
}
|
|
172
|
+
if (auth?.ok && !auth.apiKey && ctx.hasUI) {
|
|
170
173
|
ctx.ui.notify("No API key for openai/gpt-5.2", "warning");
|
|
171
174
|
}
|
|
172
175
|
|
|
173
|
-
if (!model || !apiKey) {
|
|
176
|
+
if (!model || !auth?.ok || !auth.apiKey) {
|
|
174
177
|
return;
|
|
175
178
|
}
|
|
176
179
|
|
|
@@ -182,7 +185,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
182
185
|
},
|
|
183
186
|
];
|
|
184
187
|
|
|
185
|
-
const response = await complete(
|
|
188
|
+
const response = await complete(
|
|
189
|
+
model,
|
|
190
|
+
{ messages: summaryMessages },
|
|
191
|
+
{
|
|
192
|
+
apiKey: auth.apiKey,
|
|
193
|
+
headers: auth.headers,
|
|
194
|
+
reasoningEffort: "high",
|
|
195
|
+
},
|
|
196
|
+
);
|
|
186
197
|
|
|
187
198
|
const summary = response.content
|
|
188
199
|
.filter((c): c is { type: "text"; text: string } => c.type === "text")
|
|
@@ -130,8 +130,6 @@ export default function (pi: ExtensionAPI) {
|
|
|
130
130
|
|
|
131
131
|
// Reconstruct state on session events
|
|
132
132
|
pi.on("session_start", async (_event, ctx) => reconstructState(ctx));
|
|
133
|
-
pi.on("session_switch", async (_event, ctx) => reconstructState(ctx));
|
|
134
|
-
pi.on("session_fork", async (_event, ctx) => reconstructState(ctx));
|
|
135
133
|
pi.on("session_tree", async (_event, ctx) => reconstructState(ctx));
|
|
136
134
|
|
|
137
135
|
// Register the todo tool for the LLM
|
|
@@ -138,9 +138,4 @@ export default function toolsExtension(pi: ExtensionAPI) {
|
|
|
138
138
|
pi.on("session_tree", async (_event, ctx) => {
|
|
139
139
|
restoreFromBranch(ctx);
|
|
140
140
|
});
|
|
141
|
-
|
|
142
|
-
// Restore state after forking
|
|
143
|
-
pi.on("session_fork", async (_event, ctx) => {
|
|
144
|
-
restoreFromBranch(ctx);
|
|
145
|
-
});
|
|
146
141
|
}
|
|
@@ -3,6 +3,8 @@ import type { ExtensionAPI, ExtensionContext } from "@draht/coding-agent";
|
|
|
3
3
|
const COMPACT_THRESHOLD_TOKENS = 100_000;
|
|
4
4
|
|
|
5
5
|
export default function (pi: ExtensionAPI) {
|
|
6
|
+
let previousTokens: number | null | undefined;
|
|
7
|
+
|
|
6
8
|
const triggerCompaction = (ctx: ExtensionContext, customInstructions?: string) => {
|
|
7
9
|
if (ctx.hasUI) {
|
|
8
10
|
ctx.ui.notify("Compaction started", "info");
|
|
@@ -24,7 +26,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
24
26
|
|
|
25
27
|
pi.on("turn_end", (_event, ctx) => {
|
|
26
28
|
const usage = ctx.getContextUsage();
|
|
27
|
-
|
|
29
|
+
const currentTokens = usage?.tokens ?? null;
|
|
30
|
+
if (currentTokens === null) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const crossedThreshold =
|
|
35
|
+
previousTokens !== undefined && previousTokens !== null && previousTokens <= COMPACT_THRESHOLD_TOKENS;
|
|
36
|
+
previousTokens = currentTokens;
|
|
37
|
+
if (!crossedThreshold || currentTokens <= COMPACT_THRESHOLD_TOKENS) {
|
|
28
38
|
return;
|
|
29
39
|
}
|
|
30
40
|
triggerCompaction(ctx);
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import type { ExtensionAPI
|
|
2
|
-
|
|
3
|
-
const applyWidgets = (ctx: ExtensionContext) => {
|
|
4
|
-
if (!ctx.hasUI) return;
|
|
5
|
-
ctx.ui.setWidget("widget-above", ["Above editor widget"]);
|
|
6
|
-
ctx.ui.setWidget("widget-below", ["Below editor widget"], { placement: "belowEditor" });
|
|
7
|
-
};
|
|
1
|
+
import type { ExtensionAPI } from "@draht/coding-agent";
|
|
8
2
|
|
|
9
3
|
export default function widgetPlacementExtension(pi: ExtensionAPI) {
|
|
10
4
|
pi.on("session_start", (_event, ctx) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
pi.on("session_switch", (_event, ctx) => {
|
|
15
|
-
applyWidgets(ctx);
|
|
5
|
+
if (!ctx.hasUI) return;
|
|
6
|
+
ctx.ui.setWidget("widget-above", ["Above editor widget"]);
|
|
7
|
+
ctx.ui.setWidget("widget-below", ["Below editor widget"], { placement: "belowEditor" });
|
|
16
8
|
});
|
|
17
9
|
}
|
|
@@ -9,7 +9,7 @@ import { AuthStorage, createAgentSession, ModelRegistry } from "@draht/coding-ag
|
|
|
9
9
|
|
|
10
10
|
// Set up auth storage and model registry
|
|
11
11
|
const authStorage = AuthStorage.create();
|
|
12
|
-
const modelRegistry =
|
|
12
|
+
const modelRegistry = ModelRegistry.create(authStorage);
|
|
13
13
|
|
|
14
14
|
// Option 1: Find a specific built-in model by provider/id
|
|
15
15
|
const opus = getModel("anthropic", "claude-opus-4-5");
|
|
@@ -9,7 +9,7 @@ import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "
|
|
|
9
9
|
// Default: AuthStorage uses ~/.pi/agent/auth.json
|
|
10
10
|
// ModelRegistry loads built-in + custom models from ~/.pi/agent/models.json
|
|
11
11
|
const authStorage = AuthStorage.create();
|
|
12
|
-
const modelRegistry =
|
|
12
|
+
const modelRegistry = ModelRegistry.create(authStorage);
|
|
13
13
|
|
|
14
14
|
await createAgentSession({
|
|
15
15
|
sessionManager: SessionManager.inMemory(),
|
|
@@ -20,7 +20,7 @@ console.log("Session with default auth storage and model registry");
|
|
|
20
20
|
|
|
21
21
|
// Custom auth storage location
|
|
22
22
|
const customAuthStorage = AuthStorage.create("/tmp/my-app/auth.json");
|
|
23
|
-
const customModelRegistry =
|
|
23
|
+
const customModelRegistry = ModelRegistry.create(customAuthStorage, "/tmp/my-app/models.json");
|
|
24
24
|
|
|
25
25
|
await createAgentSession({
|
|
26
26
|
sessionManager: SessionManager.inMemory(),
|
|
@@ -39,7 +39,7 @@ await createAgentSession({
|
|
|
39
39
|
console.log("Session with runtime API key override");
|
|
40
40
|
|
|
41
41
|
// No models.json - only built-in models
|
|
42
|
-
const simpleRegistry =
|
|
42
|
+
const simpleRegistry = ModelRegistry.inMemory(authStorage);
|
|
43
43
|
await createAgentSession({
|
|
44
44
|
sessionManager: SessionManager.inMemory(),
|
|
45
45
|
authStorage,
|
|
@@ -30,7 +30,7 @@ if (process.env.MY_ANTHROPIC_KEY) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
// Model registry with no custom models.json
|
|
33
|
-
const modelRegistry =
|
|
33
|
+
const modelRegistry = ModelRegistry.inMemory(authStorage);
|
|
34
34
|
|
|
35
35
|
const model = getModel("anthropic", "claude-sonnet-4-20250514");
|
|
36
36
|
if (!model) throw new Error("Model not found");
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session runtime
|
|
3
|
+
*
|
|
4
|
+
* Use AgentSessionRuntime when you need to replace the active AgentSession,
|
|
5
|
+
* for example for new-session, resume, fork, or import flows.
|
|
6
|
+
*
|
|
7
|
+
* The important pattern is: after the runtime replaces the active session,
|
|
8
|
+
* rebind any session-local subscriptions and extension bindings to `runtime.session`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
type CreateAgentSessionRuntimeFactory,
|
|
13
|
+
createAgentSessionFromServices,
|
|
14
|
+
createAgentSessionRuntime,
|
|
15
|
+
createAgentSessionServices,
|
|
16
|
+
getAgentDir,
|
|
17
|
+
SessionManager,
|
|
18
|
+
} from "@draht/coding-agent";
|
|
19
|
+
|
|
20
|
+
const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionManager, sessionStartEvent }) => {
|
|
21
|
+
const services = await createAgentSessionServices({ cwd });
|
|
22
|
+
return {
|
|
23
|
+
...(await createAgentSessionFromServices({
|
|
24
|
+
services,
|
|
25
|
+
sessionManager,
|
|
26
|
+
sessionStartEvent,
|
|
27
|
+
})),
|
|
28
|
+
services,
|
|
29
|
+
diagnostics: services.diagnostics,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const runtime = await createAgentSessionRuntime(createRuntime, {
|
|
33
|
+
cwd: process.cwd(),
|
|
34
|
+
agentDir: getAgentDir(),
|
|
35
|
+
sessionManager: SessionManager.create(process.cwd()),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
let unsubscribe: (() => void) | undefined;
|
|
39
|
+
|
|
40
|
+
async function bindSession() {
|
|
41
|
+
unsubscribe?.();
|
|
42
|
+
const session = runtime.session;
|
|
43
|
+
await session.bindExtensions({});
|
|
44
|
+
unsubscribe = session.subscribe((event) => {
|
|
45
|
+
if (event.type === "queue_update") {
|
|
46
|
+
console.log("Queued:", event.steering.length + event.followUp.length);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return session;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let session = await bindSession();
|
|
53
|
+
const originalSessionFile = session.sessionFile;
|
|
54
|
+
console.log("Initial session:", originalSessionFile);
|
|
55
|
+
|
|
56
|
+
await runtime.newSession();
|
|
57
|
+
session = await bindSession();
|
|
58
|
+
console.log("After newSession():", session.sessionFile);
|
|
59
|
+
|
|
60
|
+
if (originalSessionFile) {
|
|
61
|
+
await runtime.switchSession(originalSessionFile);
|
|
62
|
+
session = await bindSession();
|
|
63
|
+
console.log("After switchSession():", session.sessionFile);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
unsubscribe?.();
|
|
67
|
+
await runtime.dispose();
|
package/examples/sdk/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# SDK Examples
|
|
2
2
|
|
|
3
|
-
Programmatic usage of
|
|
3
|
+
Programmatic usage of draht coding agent via `createAgentSession()` and `createAgentSessionRuntime()`.
|
|
4
|
+
|
|
5
|
+
The runtime example shows how to build a recreate function that closes over process-global fixed inputs and recreates cwd-bound services and sessions as the active session cwd changes.
|
|
4
6
|
|
|
5
7
|
## Examples
|
|
6
8
|
|
|
@@ -18,6 +20,7 @@ Programmatic usage of @draht/coding-agent via `createAgentSession()`.
|
|
|
18
20
|
| `10-settings.ts` | Override compaction, retry, terminal settings |
|
|
19
21
|
| `11-sessions.ts` | In-memory, persistent, continue, list sessions |
|
|
20
22
|
| `12-full-control.ts` | Replace everything, no discovery |
|
|
23
|
+
| `13-session-runtime.ts` | Manage runtime-backed session replacement |
|
|
21
24
|
|
|
22
25
|
## Running
|
|
23
26
|
|
|
@@ -44,7 +47,7 @@ import {
|
|
|
44
47
|
|
|
45
48
|
// Auth and models setup
|
|
46
49
|
const authStorage = AuthStorage.create();
|
|
47
|
-
const modelRegistry =
|
|
50
|
+
const modelRegistry = ModelRegistry.create(authStorage);
|
|
48
51
|
|
|
49
52
|
// Minimal
|
|
50
53
|
const { session } = await createAgentSession({ authStorage, modelRegistry });
|
|
@@ -73,7 +76,7 @@ const { session } = await createAgentSession({
|
|
|
73
76
|
// Full control
|
|
74
77
|
const customAuth = AuthStorage.create("/my/app/auth.json");
|
|
75
78
|
customAuth.setRuntimeApiKey("anthropic", process.env.MY_KEY!);
|
|
76
|
-
const customRegistry =
|
|
79
|
+
const customRegistry = ModelRegistry.create(customAuth);
|
|
77
80
|
|
|
78
81
|
const resourceLoader = new DefaultResourceLoader({
|
|
79
82
|
systemPromptOverride: () => "You are helpful.",
|
|
@@ -109,9 +112,9 @@ await session.prompt("Hello");
|
|
|
109
112
|
| Option | Default | Description |
|
|
110
113
|
|--------|---------|-------------|
|
|
111
114
|
| `authStorage` | `AuthStorage.create()` | Credential storage |
|
|
112
|
-
| `modelRegistry` | `
|
|
115
|
+
| `modelRegistry` | `ModelRegistry.create(authStorage)` | Model registry |
|
|
113
116
|
| `cwd` | `process.cwd()` | Working directory |
|
|
114
|
-
| `agentDir` | `~/.
|
|
117
|
+
| `agentDir` | `~/.pi/agent` | Config directory |
|
|
115
118
|
| `model` | From settings/first available | Model to use |
|
|
116
119
|
| `thinkingLevel` | From settings/"off" | off, low, medium, high |
|
|
117
120
|
| `tools` | `codingTools` | Built-in tools |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draht/coding-agent",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.4.23",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"drahtConfig": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"clean": "shx rm -rf dist",
|
|
39
39
|
"dev": "tsgo -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
40
40
|
"build": "tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js && bun run copy-assets",
|
|
41
|
-
"build:binary": "bun run build && bun build --compile ./dist/cli.js --outfile dist/
|
|
41
|
+
"build:binary": "bun run build && bun build --compile ./dist/cli.js --outfile dist/draht && bun run copy-binary-assets",
|
|
42
42
|
"copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/ && shx rm -rf dist/prompts dist/hooks dist/agents && shx cp -r prompts dist/prompts && shx cp -r hooks dist/hooks && shx cp -r agents dist/agents",
|
|
43
43
|
"copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp -r prompts dist/ && shx cp -r hooks dist/ && shx cp -r agents dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/",
|
|
44
44
|
"test": "vitest --run",
|
|
@@ -46,12 +46,11 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@mariozechner/jiti": "^2.6.2",
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
51
|
-
"@draht/
|
|
52
|
-
"@draht/ai": "2026.3.25",
|
|
53
|
-
"@draht/tui": "2026.3.25",
|
|
49
|
+
"@draht/agent-core": "2026.4.23",
|
|
50
|
+
"@draht/ai": "2026.4.23",
|
|
51
|
+
"@draht/tui": "2026.4.23",
|
|
54
52
|
"@silvia-odwyer/photon-node": "^0.3.4",
|
|
53
|
+
"ajv": "^8.17.1",
|
|
55
54
|
"chalk": "^5.5.0",
|
|
56
55
|
"cli-highlight": "^2.1.11",
|
|
57
56
|
"diff": "^8.0.2",
|
|
@@ -94,7 +93,7 @@
|
|
|
94
93
|
"tui",
|
|
95
94
|
"agent"
|
|
96
95
|
],
|
|
97
|
-
"author": "
|
|
96
|
+
"author": "Mario Zechner",
|
|
98
97
|
"license": "MIT",
|
|
99
98
|
"publishConfig": {
|
|
100
99
|
"access": "public"
|