@bastani/atomic 0.8.3-0 → 0.8.4-0
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 +33 -17
- package/README.md +3 -3
- package/dist/builtin/intercom/index.ts +1 -1
- package/dist/builtin/intercom/package.json +1 -5
- package/dist/builtin/intercom/ui/compose.ts +1 -1
- package/dist/builtin/intercom/ui/inline-message.ts +1 -1
- package/dist/builtin/intercom/ui/session-list.ts +1 -1
- package/dist/builtin/mcp/commands.ts +1 -1
- package/dist/builtin/mcp/direct-tools.ts +1 -1
- package/dist/builtin/mcp/index.ts +1 -1
- package/dist/builtin/mcp/init.ts +1 -1
- package/dist/builtin/mcp/package.json +1 -5
- package/dist/builtin/mcp/proxy-modes.ts +1 -1
- package/dist/builtin/mcp/sampling-handler.ts +1 -1
- package/dist/builtin/mcp/state.ts +1 -1
- package/dist/builtin/mcp/tool-result-renderer.ts +1 -1
- package/dist/builtin/mcp/utils.ts +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +3 -3
- package/dist/builtin/subagents/package.json +1 -5
- package/dist/builtin/subagents/src/agents/agent-management.ts +1 -1
- package/dist/builtin/subagents/src/extension/control-notices.ts +1 -1
- package/dist/builtin/subagents/src/extension/index.ts +1 -1
- package/dist/builtin/subagents/src/runs/background/async-execution.ts +1 -1
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +1 -1
- package/dist/builtin/subagents/src/runs/background/notify.ts +1 -1
- package/dist/builtin/subagents/src/runs/foreground/chain-clarify.ts +1 -1
- package/dist/builtin/subagents/src/runs/foreground/chain-execution.ts +1 -1
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +1 -1
- package/dist/builtin/subagents/src/runs/shared/pi-spawn.ts +20 -17
- package/dist/builtin/subagents/src/runs/shared/subagent-prompt-runtime.ts +1 -1
- package/dist/builtin/subagents/src/shared/fork-context.ts +1 -1
- package/dist/builtin/subagents/src/shared/types.ts +1 -1
- package/dist/builtin/subagents/src/slash/slash-bridge.ts +1 -1
- package/dist/builtin/subagents/src/slash/slash-commands.ts +1 -1
- package/dist/builtin/subagents/src/tui/render-helpers.ts +1 -1
- package/dist/builtin/subagents/src/tui/render.ts +1 -1
- package/dist/builtin/web-access/index.ts +1 -1
- package/dist/builtin/web-access/package.json +1 -5
- package/dist/builtin/web-access/storage.ts +1 -1
- package/dist/builtin/web-access/summary-review.ts +1 -1
- package/dist/builtin/workflows/package.json +1 -5
- package/dist/builtin/workflows/src/extension/index.ts +1 -1
- package/dist/builtin/workflows/src/extension/wiring.ts +10 -10
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +1 -1
- package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +1 -1
- package/dist/builtin/workflows/src/runs/shared/workflow-runner.ts +1 -1
- package/dist/builtin/workflows/src/shared/types.ts +1 -1
- package/dist/builtin/workflows/src/tui/graph-theme.ts +2 -2
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +1 -1
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +9 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +0 -4
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +29 -12
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/system-prompt.d.ts +10 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +80 -8
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +2 -2
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +35 -9
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/compaction.md +2 -2
- package/docs/custom-provider.md +2 -2
- package/docs/extensions.md +17 -17
- package/docs/index.md +1 -1
- package/docs/packages.md +1 -1
- package/docs/quickstart.md +1 -1
- package/docs/rpc.md +1 -1
- package/docs/sdk.md +22 -22
- package/docs/session-format.md +1 -1
- package/docs/termux.md +1 -1
- package/docs/tui.md +6 -6
- package/examples/extensions/README.md +1 -1
- package/examples/extensions/auto-commit-on-exit.ts +1 -1
- package/examples/extensions/bash-spawn-hook.ts +2 -2
- package/examples/extensions/bookmark.ts +1 -1
- package/examples/extensions/border-status-editor.ts +1 -1
- package/examples/extensions/built-in-tool-renderer.ts +2 -2
- package/examples/extensions/claude-rules.ts +1 -1
- package/examples/extensions/commands.ts +1 -1
- package/examples/extensions/confirm-destructive.ts +1 -1
- package/examples/extensions/custom-compaction.ts +2 -2
- package/examples/extensions/custom-footer.ts +1 -1
- package/examples/extensions/custom-header.ts +2 -2
- package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +1 -1
- package/examples/extensions/dirty-repo-guard.ts +1 -1
- package/examples/extensions/doom-overlay/index.ts +1 -1
- package/examples/extensions/dynamic-resources/index.ts +1 -1
- package/examples/extensions/dynamic-tools.ts +1 -1
- package/examples/extensions/event-bus.ts +1 -1
- package/examples/extensions/file-trigger.ts +1 -1
- package/examples/extensions/git-checkpoint.ts +1 -1
- package/examples/extensions/github-issue-autocomplete.ts +1 -1
- package/examples/extensions/handoff.ts +2 -2
- package/examples/extensions/hello.ts +1 -1
- package/examples/extensions/hidden-thinking-label.ts +1 -1
- package/examples/extensions/inline-bash.ts +1 -1
- package/examples/extensions/input-transform.ts +1 -1
- package/examples/extensions/interactive-shell.ts +1 -1
- package/examples/extensions/mac-system-theme.ts +1 -1
- package/examples/extensions/message-renderer.ts +1 -1
- package/examples/extensions/minimal-mode.ts +2 -2
- package/examples/extensions/modal-editor.ts +1 -1
- package/examples/extensions/model-status.ts +1 -1
- package/examples/extensions/notify.ts +1 -1
- package/examples/extensions/overlay-qa-tests.ts +1 -1
- package/examples/extensions/overlay-test.ts +1 -1
- package/examples/extensions/permission-gate.ts +1 -1
- package/examples/extensions/pirate.ts +1 -1
- package/examples/extensions/plan-mode/index.ts +1 -1
- package/examples/extensions/preset.ts +2 -2
- package/examples/extensions/prompt-customizer.ts +1 -1
- package/examples/extensions/protected-paths.ts +1 -1
- package/examples/extensions/provider-payload.ts +1 -1
- package/examples/extensions/qna.ts +2 -2
- package/examples/extensions/question.ts +1 -1
- package/examples/extensions/questionnaire.ts +1 -1
- package/examples/extensions/rainbow-editor.ts +1 -1
- package/examples/extensions/reload-runtime.ts +1 -1
- package/examples/extensions/rpc-demo.ts +1 -1
- package/examples/extensions/sandbox/index.ts +2 -2
- package/examples/extensions/send-user-message.ts +1 -1
- package/examples/extensions/session-name.ts +1 -1
- package/examples/extensions/shutdown-command.ts +1 -1
- package/examples/extensions/snake.ts +1 -1
- package/examples/extensions/space-invaders.ts +1 -1
- package/examples/extensions/ssh.ts +2 -2
- package/examples/extensions/status-line.ts +1 -1
- package/examples/extensions/structured-output.ts +1 -1
- package/examples/extensions/subagent/agents.ts +1 -1
- package/examples/extensions/subagent/index.ts +1 -1
- package/examples/extensions/summarize.ts +2 -2
- package/examples/extensions/system-prompt-header.ts +1 -1
- package/examples/extensions/tic-tac-toe.ts +1 -1
- package/examples/extensions/timed-confirm.ts +1 -1
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/todo.ts +1 -1
- package/examples/extensions/tool-override.ts +1 -1
- package/examples/extensions/tools.ts +2 -2
- package/examples/extensions/trigger-compact.ts +1 -1
- package/examples/extensions/truncated-tool.ts +2 -2
- package/examples/extensions/widget-placement.ts +1 -1
- package/examples/extensions/with-deps/index.ts +1 -1
- package/examples/extensions/working-indicator.ts +1 -1
- package/examples/extensions/working-message-test.ts +1 -1
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/02-custom-model.ts +1 -1
- package/examples/sdk/03-custom-prompt.ts +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/05-tools.ts +1 -1
- package/examples/sdk/06-extensions.ts +2 -2
- package/examples/sdk/07-context-files.ts +1 -1
- package/examples/sdk/08-prompt-templates.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +1 -1
- package/examples/sdk/10-settings.ts +1 -1
- package/examples/sdk/11-sessions.ts +1 -1
- package/examples/sdk/12-full-control.ts +1 -1
- package/examples/sdk/13-session-runtime.ts +1 -1
- package/examples/sdk/README.md +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Edge case tests (wide chars, styled text, emoji)
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { ExtensionAPI, ExtensionCommandContext, Theme } from "@
|
|
11
|
+
import type { ExtensionAPI, ExtensionCommandContext, Theme } from "@bastani/atomic";
|
|
12
12
|
import { CURSOR_MARKER, type Focusable, matchesKey, visibleWidth } from "@earendil-works/pi-tui";
|
|
13
13
|
|
|
14
14
|
export default function (pi: ExtensionAPI) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Patterns checked: rm -rf, sudo, chmod/chown 777
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { ExtensionAPI } from "@
|
|
8
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
9
9
|
|
|
10
10
|
export default function (pi: ExtensionAPI) {
|
|
11
11
|
const dangerousPatterns = [/\brm\s+(-rf?|--recursive)/i, /\bsudo\b/i, /\b(chmod|chown)\b.*777/i];
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* 3. When enabled, the agent will respond like a pirate
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type { ExtensionAPI } from "@
|
|
13
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
14
14
|
|
|
15
15
|
export default function pirateExtension(pi: ExtensionAPI) {
|
|
16
16
|
let pirateMode = false;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
16
16
|
import type { AssistantMessage, TextContent } from "@earendil-works/pi-ai";
|
|
17
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
17
|
+
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
18
18
|
import { Key } from "@earendil-works/pi-tui";
|
|
19
19
|
import { extractTodoItems, isSafeCommand, markCompletedSteps, type TodoItem } from "./utils.js";
|
|
20
20
|
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
import { existsSync, readFileSync } from "node:fs";
|
|
42
42
|
import { join } from "node:path";
|
|
43
43
|
import type { Api, Model } from "@earendil-works/pi-ai";
|
|
44
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
45
|
-
import { DynamicBorder, getAgentDir } from "@
|
|
44
|
+
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
45
|
+
import { DynamicBorder, getAgentDir } from "@bastani/atomic";
|
|
46
46
|
import { Container, Key, type SelectItem, SelectList, Text } from "@earendil-works/pi-tui";
|
|
47
47
|
|
|
48
48
|
// Preset configuration
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* 2. Use the extension — it automatically adapts to your active tools and skills
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import type { BuildSystemPromptOptions, ExtensionAPI } from "@
|
|
15
|
+
import type { BuildSystemPromptOptions, ExtensionAPI } from "@bastani/atomic";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Adds tool-specific guidance that adapts to the active tool set.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Useful for preventing accidental modifications to sensitive files.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { ExtensionAPI } from "@
|
|
8
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
9
9
|
|
|
10
10
|
export default function (pi: ExtensionAPI) {
|
|
11
11
|
const protectedPaths = [".env", ".git/", "node_modules/"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { appendFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import type { ExtensionAPI } from "@
|
|
3
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
4
4
|
|
|
5
5
|
export default function (pi: ExtensionAPI) {
|
|
6
6
|
const logFile = join(process.cwd(), ".pi", "provider-payload.log");
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { complete, type UserMessage } from "@earendil-works/pi-ai";
|
|
11
|
-
import type { ExtensionAPI } from "@
|
|
12
|
-
import { BorderedLoader } from "@
|
|
11
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
12
|
+
import { BorderedLoader } from "@bastani/atomic";
|
|
13
13
|
|
|
14
14
|
const SYSTEM_PROMPT = `You are a question extractor. Given text from a conversation, extract any questions that need answering and format them for the user to fill in.
|
|
15
15
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Escape in editor returns to options, Escape in options cancels
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { ExtensionAPI } from "@
|
|
7
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
8
8
|
import { Editor, type EditorTheme, Key, matchesKey, Text, truncateToWidth } from "@earendil-works/pi-tui";
|
|
9
9
|
import { Type } from "typebox";
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Multiple questions: tab bar navigation between questions
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { ExtensionAPI } from "@
|
|
8
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
9
9
|
import { Editor, type EditorTheme, Key, matchesKey, Text, truncateToWidth } from "@earendil-works/pi-tui";
|
|
10
10
|
import { Type } from "typebox";
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Usage: pi --extension ./examples/extensions/rainbow-editor.ts
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { CustomEditor, type ExtensionAPI } from "@
|
|
7
|
+
import { CustomEditor, type ExtensionAPI } from "@bastani/atomic";
|
|
8
8
|
|
|
9
9
|
// Base colors (coral → yellow → green → teal → blue → purple → pink)
|
|
10
10
|
const COLORS: [number, number, number][] = [
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* tool that queues a follow-up command to trigger reload.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { ExtensionAPI } from "@
|
|
8
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
9
9
|
import { Type } from "typebox";
|
|
10
10
|
|
|
11
11
|
export default function (pi: ExtensionAPI) {
|
|
@@ -45,8 +45,8 @@ import { spawn } from "node:child_process";
|
|
|
45
45
|
import { existsSync, readFileSync } from "node:fs";
|
|
46
46
|
import { join } from "node:path";
|
|
47
47
|
import { SandboxManager, type SandboxRuntimeConfig } from "@anthropic-ai/sandbox-runtime";
|
|
48
|
-
import type { ExtensionAPI } from "@
|
|
49
|
-
import { type BashOperations, createBashTool, getAgentDir } from "@
|
|
48
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
49
|
+
import { type BashOperations, createBashTool, getAgentDir } from "@bastani/atomic";
|
|
50
50
|
|
|
51
51
|
interface SandboxConfig extends SandboxRuntimeConfig {
|
|
52
52
|
enabled?: boolean;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* /followup And then? - Sends while streaming with followUp delivery
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import type { ExtensionAPI } from "@
|
|
14
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
15
15
|
|
|
16
16
|
export default function (pi: ExtensionAPI) {
|
|
17
17
|
// Simple command that sends a user message
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Usage: /session-name [name] - set or show session name
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { ExtensionAPI } from "@
|
|
10
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
11
11
|
|
|
12
12
|
export default function (pi: ExtensionAPI) {
|
|
13
13
|
pi.registerCommand("session-name", {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Demonstrates how extensions can use ctx.shutdown() to exit pi cleanly.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { ExtensionAPI } from "@
|
|
8
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
9
9
|
import { Type } from "typebox";
|
|
10
10
|
|
|
11
11
|
export default function (pi: ExtensionAPI) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Snake game extension - play snake with /snake command
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { ExtensionAPI } from "@
|
|
5
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
6
6
|
import { matchesKey, visibleWidth } from "@earendil-works/pi-tui";
|
|
7
7
|
|
|
8
8
|
const GAME_WIDTH = 40;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Uses Kitty keyboard protocol for smooth movement (press/release detection)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ExtensionAPI } from "@
|
|
6
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
7
7
|
import { isKeyRelease, Key, matchesKey, visibleWidth } from "@earendil-works/pi-tui";
|
|
8
8
|
|
|
9
9
|
const GAME_WIDTH = 60;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { spawn } from "node:child_process";
|
|
17
|
-
import type { ExtensionAPI } from "@
|
|
17
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
18
18
|
import {
|
|
19
19
|
type BashOperations,
|
|
20
20
|
createBashTool,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
type EditOperations,
|
|
25
25
|
type ReadOperations,
|
|
26
26
|
type WriteOperations,
|
|
27
|
-
} from "@
|
|
27
|
+
} from "@bastani/atomic";
|
|
28
28
|
|
|
29
29
|
function sshExec(remote: string, command: string): Promise<Buffer> {
|
|
30
30
|
return new Promise((resolve, reject) => {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* without paying for an extra follow-up LLM turn.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { defineTool, type ExtensionAPI } from "@
|
|
8
|
+
import { defineTool, type ExtensionAPI } from "@bastani/atomic";
|
|
9
9
|
import { Text } from "@earendil-works/pi-tui";
|
|
10
10
|
import { Type } from "typebox";
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
-
import { getAgentDir, parseFrontmatter } from "@
|
|
7
|
+
import { getAgentDir, parseFrontmatter } from "@bastani/atomic";
|
|
8
8
|
|
|
9
9
|
export type AgentScope = "user" | "project" | "both";
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ import * as path from "node:path";
|
|
|
19
19
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
20
20
|
import type { Message } from "@earendil-works/pi-ai";
|
|
21
21
|
import { StringEnum } from "@earendil-works/pi-ai";
|
|
22
|
-
import { type ExtensionAPI, getMarkdownTheme, withFileMutationQueue } from "@
|
|
22
|
+
import { type ExtensionAPI, getMarkdownTheme, withFileMutationQueue } from "@bastani/atomic";
|
|
23
23
|
import { Container, Markdown, Spacer, Text } from "@earendil-works/pi-tui";
|
|
24
24
|
import { Type } from "typebox";
|
|
25
25
|
import { type AgentConfig, type AgentScope, discoverAgents } from "./agents.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { complete, getModel } from "@earendil-works/pi-ai";
|
|
2
|
-
import type { ExtensionAPI, ExtensionCommandContext } from "@
|
|
3
|
-
import { DynamicBorder, getMarkdownTheme } from "@
|
|
2
|
+
import type { ExtensionAPI, ExtensionCommandContext } from "@bastani/atomic";
|
|
3
|
+
import { DynamicBorder, getMarkdownTheme } from "@bastani/atomic";
|
|
4
4
|
import { Container, Markdown, matchesKey, Text } from "@earendil-works/pi-tui";
|
|
5
5
|
|
|
6
6
|
type ContentBlock = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Demonstrates ctx.getSystemPrompt() for accessing the effective system prompt.
|
|
5
5
|
*/
|
|
6
|
-
import type { ExtensionAPI } from "@
|
|
6
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
7
7
|
|
|
8
8
|
export default function (pi: ExtensionAPI) {
|
|
9
9
|
pi.on("agent_start", (_event, ctx) => {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { StringEnum } from "@earendil-works/pi-ai";
|
|
21
|
-
import type { ExtensionAPI, ExtensionContext, Theme, ToolExecutionMode } from "@
|
|
21
|
+
import type { ExtensionAPI, ExtensionContext, Theme, ToolExecutionMode } from "@bastani/atomic";
|
|
22
22
|
import { type Component, matchesKey, Text, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
23
23
|
import { Type } from "typebox";
|
|
24
24
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - /timed-signal - Shows confirm using AbortSignal (manual approach)
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { ExtensionAPI } from "@
|
|
10
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
11
11
|
|
|
12
12
|
export default function (pi: ExtensionAPI) {
|
|
13
13
|
// Simple approach: use timeout option (recommended)
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import path from "node:path";
|
|
12
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
12
|
+
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
13
13
|
|
|
14
14
|
const BRAILLE_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
15
15
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { StringEnum } from "@earendil-works/pi-ai";
|
|
14
|
-
import type { ExtensionAPI, ExtensionContext, Theme } from "@
|
|
14
|
+
import type { ExtensionAPI, ExtensionContext, Theme } from "@bastani/atomic";
|
|
15
15
|
import { matchesKey, Text, truncateToWidth } from "@earendil-works/pi-tui";
|
|
16
16
|
import { Type } from "typebox";
|
|
17
17
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import type { TextContent } from "@earendil-works/pi-ai";
|
|
24
|
-
import { type ExtensionAPI, getAgentDir, withFileMutationQueue } from "@
|
|
24
|
+
import { type ExtensionAPI, getAgentDir, withFileMutationQueue } from "@bastani/atomic";
|
|
25
25
|
import { constants, readFileSync } from "fs";
|
|
26
26
|
import { access, appendFile, readFile } from "fs/promises";
|
|
27
27
|
import { join, resolve } from "path";
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* 2. Use /tools to open the tool selector
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type { ExtensionAPI, ExtensionContext, ToolInfo } from "@
|
|
13
|
-
import { getSettingsListTheme } from "@
|
|
12
|
+
import type { ExtensionAPI, ExtensionContext, ToolInfo } from "@bastani/atomic";
|
|
13
|
+
import { getSettingsListTheme } from "@bastani/atomic";
|
|
14
14
|
import { Container, type SettingItem, SettingsList } from "@earendil-works/pi-tui";
|
|
15
15
|
|
|
16
16
|
// State persisted to session
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { mkdtemp, writeFile } from "node:fs/promises";
|
|
18
|
-
import type { ExtensionAPI } from "@
|
|
18
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
19
19
|
import {
|
|
20
20
|
DEFAULT_MAX_BYTES,
|
|
21
21
|
DEFAULT_MAX_LINES,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
type TruncationResult,
|
|
24
24
|
truncateHead,
|
|
25
25
|
withFileMutationQueue,
|
|
26
|
-
} from "@
|
|
26
|
+
} from "@bastani/atomic";
|
|
27
27
|
import { Text } from "@earendil-works/pi-tui";
|
|
28
28
|
import { execSync } from "child_process";
|
|
29
29
|
import { tmpdir } from "os";
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* /working-indicator reset Restore pi's default spinner
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import type { ExtensionAPI, ExtensionContext, WorkingIndicatorOptions } from "@
|
|
19
|
+
import type { ExtensionAPI, ExtensionContext, WorkingIndicatorOptions } from "@bastani/atomic";
|
|
20
20
|
|
|
21
21
|
type WorkingIndicatorMode = "dot" | "none" | "pulse" | "spinner" | "default";
|
|
22
22
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* loader appears, not revert to the default gray "Working...".
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import type { ExtensionAPI } from "@
|
|
15
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
16
16
|
|
|
17
17
|
const CUSTOM_MESSAGE = "\x1b[38;2;155;86;63mWorking... (custom)\x1b[39m";
|
|
18
18
|
const CUSTOM_INDICATOR = { frames: ["\x1b[38;2;155;86;63m●\x1b[39m"] };
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* from cwd and ~/.pi/agent. Model chosen from settings or first available.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { createAgentSession } from "@
|
|
8
|
+
import { createAgentSession } from "@bastani/atomic";
|
|
9
9
|
|
|
10
10
|
const { session } = await createAgentSession();
|
|
11
11
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { getModel } from "@earendil-works/pi-ai";
|
|
8
|
-
import { AuthStorage, createAgentSession, ModelRegistry } from "@
|
|
8
|
+
import { AuthStorage, createAgentSession, ModelRegistry } from "@bastani/atomic";
|
|
9
9
|
|
|
10
10
|
// Set up auth storage and model registry
|
|
11
11
|
const authStorage = AuthStorage.create();
|
package/examples/sdk/05-tools.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* extensions system using pi.registerTool().
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { createAgentSession, SessionManager } from "@
|
|
13
|
+
import { createAgentSession, SessionManager } from "@bastani/atomic";
|
|
14
14
|
|
|
15
15
|
// Read-only mode (no edit/write)
|
|
16
16
|
const { session: readOnlySession } = await createAgentSession({
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
DefaultResourceLoader,
|
|
19
19
|
getAgentDir,
|
|
20
20
|
SessionManager,
|
|
21
|
-
} from "@
|
|
21
|
+
} from "@bastani/atomic";
|
|
22
22
|
|
|
23
23
|
// Extensions are discovered automatically from standard locations.
|
|
24
24
|
// You can also add paths via settings.json or DefaultResourceLoader options.
|
|
@@ -57,7 +57,7 @@ try {
|
|
|
57
57
|
|
|
58
58
|
// Example extension file (./my-logging-extension.ts):
|
|
59
59
|
/*
|
|
60
|
-
import type { ExtensionAPI } from "@
|
|
60
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
61
61
|
|
|
62
62
|
export default function (pi: ExtensionAPI) {
|
|
63
63
|
pi.on("agent_start", async () => {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
DefaultResourceLoader,
|
|
10
10
|
getAgentDir,
|
|
11
11
|
SessionManager,
|
|
12
|
-
} from "@
|
|
12
|
+
} from "@bastani/atomic";
|
|
13
13
|
|
|
14
14
|
// Disable context files entirely by returning an empty list in agentsFilesOverride.
|
|
15
15
|
const loader = new DefaultResourceLoader({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Configure API key resolution via AuthStorage and ModelRegistry.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@
|
|
7
|
+
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@bastani/atomic";
|
|
8
8
|
|
|
9
9
|
// Default: AuthStorage uses ~/.pi/agent/auth.json
|
|
10
10
|
// ModelRegistry loads built-in + custom models from ~/.pi/agent/models.json
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Override settings using SettingsManager.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { createAgentSession, SessionManager, SettingsManager } from "@
|
|
7
|
+
import { createAgentSession, SessionManager, SettingsManager } from "@bastani/atomic";
|
|
8
8
|
|
|
9
9
|
const cwd = process.cwd();
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Control session persistence: in-memory, new file, continue, or open specific.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { createAgentSession, SessionManager } from "@
|
|
7
|
+
import { createAgentSession, SessionManager } from "@bastani/atomic";
|
|
8
8
|
|
|
9
9
|
// In-memory (no persistence)
|
|
10
10
|
const { session: inMemory } = await createAgentSession({
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
createAgentSessionServices,
|
|
16
16
|
getAgentDir,
|
|
17
17
|
SessionManager,
|
|
18
|
-
} from "@
|
|
18
|
+
} from "@bastani/atomic";
|
|
19
19
|
|
|
20
20
|
const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionManager, sessionStartEvent }) => {
|
|
21
21
|
const services = await createAgentSessionServices({ cwd });
|
package/examples/sdk/README.md
CHANGED