@bastani/atomic 0.8.3 → 0.8.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 +37 -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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.8.4] - 2026-05-17
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added selected model details to the system prompt for assistant model attribution.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Aligned package references with Atomic branding.
|
|
14
|
+
|
|
15
|
+
## [0.8.4-0] - 2026-05-17
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Added selected model details to the system prompt for assistant model attribution.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Aligned package references with Atomic branding.
|
|
24
|
+
|
|
5
25
|
## [0.8.3] - 2026-05-17
|
|
6
26
|
|
|
7
27
|
### Changed
|
|
@@ -89,7 +109,7 @@
|
|
|
89
109
|
|
|
90
110
|
### New Features
|
|
91
111
|
|
|
92
|
-
- **Self-update support for the npm scope migration**: `pi update --self` now supports the upcoming package rename from `@
|
|
112
|
+
- **Self-update support for the npm scope migration**: `pi update --self` now supports the upcoming package rename from `@bastani/atomic` to `@bastani/atomic`. After the new package is published, existing global installs can update through the normal self-update flow; pi will uninstall the old global package and install the package name returned by the version check endpoint.
|
|
93
113
|
- **Interactive OAuth login selection**: OAuth providers can now present multiple login choices in `/login`, enabling provider-specific interactive authentication flows. See [Providers](docs/providers.md).
|
|
94
114
|
- **JSONC-style `models.json` parsing**: `models.json` now allows comments and trailing commas, making custom provider and model configuration easier to maintain. See [Providers](docs/providers.md) and [Custom Providers](docs/custom-provider.md).
|
|
95
115
|
|
|
@@ -457,7 +477,7 @@
|
|
|
457
477
|
### Breaking Changes
|
|
458
478
|
|
|
459
479
|
- Changed SDK and CLI tool selection from cwd-bound built-in tool instances to tool-name allowlists. `createAgentSession({ tools })` now expects `string[]` names such as `"read"` and `"bash"` instead of `Tool[]`, `--tools` now allowlists built-in, extension, and custom tools by name, and `--no-tools` now disables all tools by default rather than only built-ins. Migrate SDK code from `tools: [readTool, bashTool]` to `tools: ["read", "bash"]` ([#2835](https://github.com/badlogic/pi-mono/issues/2835), [#3452](https://github.com/badlogic/pi-mono/issues/3452))
|
|
460
|
-
- Removed prebuilt cwd-bound tool and tool-definition exports from `@
|
|
480
|
+
- Removed prebuilt cwd-bound tool and tool-definition exports from `@bastani/atomic`, including `readTool`, `bashTool`, `editTool`, `writeTool`, `grepTool`, `findTool`, `lsTool`, `readOnlyTools`, `codingTools`, and the corresponding `*ToolDefinition` values. Use the explicit factory exports instead, for example `createReadTool(cwd)`, `createBashTool(cwd)`, `createCodingTools(cwd)`, and `createReadToolDefinition(cwd)` ([#3452](https://github.com/badlogic/pi-mono/issues/3452))
|
|
461
481
|
- Removed ambient `process.cwd()` / default agent-dir fallback behavior from public resource helpers. `DefaultResourceLoader`, `loadProjectContextFiles()`, and `loadSkills()` now require explicit cwd/agent-dir style inputs, and exported system-prompt option types now require an explicit `cwd`. Pass the session or project cwd explicitly instead of relying on process-global defaults ([#3452](https://github.com/badlogic/pi-mono/issues/3452))
|
|
462
482
|
|
|
463
483
|
### Added
|
|
@@ -488,8 +508,8 @@
|
|
|
488
508
|
- Fixed OpenAI-compatible Chat Completions sessions to optionally send aligned `session_id`, `x-client-request-id`, and `x-session-affinity` headers from `sessionId` via `compat.sendSessionAffinityHeaders`, improving cache-affinity routing for backends such as Fireworks ([#3430](https://github.com/badlogic/pi-mono/issues/3430))
|
|
489
509
|
- Fixed threaded `/resume` session relationships and current-session detection to canonicalize symlinked session paths during selector comparisons, so shared session directories no longer break parent-child matching or active-session delete protection ([#3364](https://github.com/badlogic/pi-mono/issues/3364))
|
|
490
510
|
- Fixed `/session`, Sessions docs, and CLI help to consistently document that session reuse supports both file paths and session IDs, and that `/session` shows the current session ID ([#3390](https://github.com/badlogic/pi-mono/issues/3390))
|
|
491
|
-
- Fixed Windows pnpm global install detection to recognize `\\.pnpm\\` store paths, so update notices now suggest `pnpm install -g @
|
|
492
|
-
- Fixed missing `@sinclair/typebox` runtime dependency in `@
|
|
511
|
+
- Fixed Windows pnpm global install detection to recognize `\\.pnpm\\` store paths, so update notices now suggest `pnpm install -g @bastani/atomic` instead of falling back to npm ([#3378](https://github.com/badlogic/pi-mono/issues/3378))
|
|
512
|
+
- Fixed missing `@sinclair/typebox` runtime dependency in `@bastani/atomic`, so strict pnpm installs no longer fail with `ERR_MODULE_NOT_FOUND` when starting `pi` ([#3434](https://github.com/badlogic/pi-mono/issues/3434))
|
|
493
513
|
- Fixed xterm uppercase typing in the interactive editor by decoding printable `modifyOtherKeys` input and normalizing shifted letter matching, so `Shift+letter` no longer disappears in `pi` ([#3436](https://github.com/badlogic/pi-mono/issues/3436))
|
|
494
514
|
- Fixed `/compact` to reuse the session thinking level for compaction summaries instead of forcing `high`, avoiding invalid reasoning-effort errors on `github-copilot/claude-opus-4.7` sessions configured for `medium` thinking ([#3438](https://github.com/badlogic/pi-mono/issues/3438))
|
|
495
515
|
- Fixed shared/exported plain-text tool output to preserve indentation instead of collapsing leading whitespace in the web share page ([#3440](https://github.com/badlogic/pi-mono/issues/3440))
|
|
@@ -526,7 +546,7 @@
|
|
|
526
546
|
- Fixed compact interactive extension startup summaries to disambiguate package extensions and repeated local `index.ts` entries by using package-aware labels and the minimal parent path needed to make local entries unique ([#3308](https://github.com/badlogic/pi-mono/issues/3308))
|
|
527
547
|
- Fixed git package dependency installation to use production installs (`npm install --omit=dev`) during both install and update flows, so extension runtime dependencies must come from `dependencies` and not `devDependencies` ([#3009](https://github.com/badlogic/pi-mono/issues/3009))
|
|
528
548
|
- Fixed `tool_result` / `afterToolCall` extension handling for error results by forwarding `details` and `isError` overrides through `AgentSession` instead of dropping them when `isError` was already true ([#3051](https://github.com/badlogic/pi-mono/issues/3051))
|
|
529
|
-
- Fixed missing root exports for `RpcClient` and RPC protocol types from `@
|
|
549
|
+
- Fixed missing root exports for `RpcClient` and RPC protocol types from `@bastani/atomic`, so ESM consumers can import them from the main package entrypoint ([#3275](https://github.com/badlogic/pi-mono/issues/3275))
|
|
530
550
|
- Fixed OpenAI Codex service-tier cost accounting to trust the explicitly requested tier when the API echoes the default tier in responses, keeping session cost displays aligned with the selected tier ([#3307](https://github.com/badlogic/pi-mono/pull/3307) by [@markusylisiurunen](https://github.com/markusylisiurunen))
|
|
531
551
|
- Fixed parallel tool-call finalization to convert `afterToolCall` hook throws into error tool results instead of aborting the remaining tool batch ([#3084](https://github.com/badlogic/pi-mono/issues/3084))
|
|
532
552
|
- Fixed Bun binary asset path resolution to honor `PI_PACKAGE_DIR` for built-in themes, HTML export templates, and interactive bundled assets ([#3074](https://github.com/badlogic/pi-mono/issues/3074))
|
|
@@ -790,7 +810,7 @@ import {
|
|
|
790
810
|
createAgentSessionServices,
|
|
791
811
|
getAgentDir,
|
|
792
812
|
SessionManager,
|
|
793
|
-
} from "@
|
|
813
|
+
} from "@bastani/atomic";
|
|
794
814
|
|
|
795
815
|
const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionManager, sessionStartEvent }) => {
|
|
796
816
|
const services = await createAgentSessionServices({ cwd });
|
|
@@ -980,7 +1000,7 @@ Examples:
|
|
|
980
1000
|
|
|
981
1001
|
### Changed
|
|
982
1002
|
|
|
983
|
-
- Built-in tools now work like custom tools in extensions. To get built-in tool definitions, import `readToolDefinition` / `createReadToolDefinition()` and the equivalent `bash`, `edit`, `write`, `grep`, `find`, and `ls` exports from `@
|
|
1003
|
+
- Built-in tools now work like custom tools in extensions. To get built-in tool definitions, import `readToolDefinition` / `createReadToolDefinition()` and the equivalent `bash`, `edit`, `write`, `grep`, `find`, and `ls` exports from `@bastani/atomic`.
|
|
984
1004
|
- Cleaned up `buildSystemPrompt()` so built-in tool snippets and tool-local guidelines come from built-in `ToolDefinition` metadata, while cross-tool and global prompt rules stay in system prompt construction.
|
|
985
1005
|
- Added structured `sourceInfo` to `pi.getAllTools()` results for built-in, SDK, and extension tools ([#1734](https://github.com/badlogic/pi-mono/issues/1734))
|
|
986
1006
|
|
|
@@ -1008,7 +1028,7 @@ Examples:
|
|
|
1008
1028
|
|
|
1009
1029
|
### Added
|
|
1010
1030
|
|
|
1011
|
-
- Added `ToolCallEventResult` to the `@
|
|
1031
|
+
- Added `ToolCallEventResult` to the `@bastani/atomic` top-level and core extension exports so extension authors can type explicit `tool_call` handler return values ([#2458](https://github.com/badlogic/pi-mono/issues/2458))
|
|
1012
1032
|
|
|
1013
1033
|
### Changed
|
|
1014
1034
|
|
|
@@ -1815,7 +1835,7 @@ Examples:
|
|
|
1815
1835
|
- **Android/Termux support**: Pi now runs on Android via Termux. Install with:
|
|
1816
1836
|
```bash
|
|
1817
1837
|
pkg install nodejs termux-api git
|
|
1818
|
-
npm install -g @
|
|
1838
|
+
npm install -g @bastani/atomic
|
|
1819
1839
|
mkdir -p ~/.pi/agent
|
|
1820
1840
|
echo "You are running on Android in Termux." > ~/.pi/agent/AGENTS.md
|
|
1821
1841
|
```
|
|
@@ -2331,7 +2351,7 @@ There are multiple SDK breaking changes since v0.49.3. For the quickest migratio
|
|
|
2331
2351
|
|
|
2332
2352
|
### Fixed
|
|
2333
2353
|
|
|
2334
|
-
- Extensions now load correctly in compiled Bun binary using `@mariozechner/jiti` fork with `virtualModules` support. Bundled packages (`@sinclair/typebox`, `@mariozechner/pi-tui`, `@mariozechner/pi-ai`, `@
|
|
2354
|
+
- Extensions now load correctly in compiled Bun binary using `@mariozechner/jiti` fork with `virtualModules` support. Bundled packages (`@sinclair/typebox`, `@mariozechner/pi-tui`, `@mariozechner/pi-ai`, `@bastani/atomic`) are accessible to extensions without filesystem node_modules.
|
|
2335
2355
|
|
|
2336
2356
|
## [0.45.1] - 2026-01-13
|
|
2337
2357
|
|
|
@@ -2712,16 +2732,16 @@ No recursion beyond one level. Complex packages must use the `package.json` mani
|
|
|
2712
2732
|
|
|
2713
2733
|
```typescript
|
|
2714
2734
|
// Before (hook)
|
|
2715
|
-
import type { HookAPI, HookContext } from "@
|
|
2735
|
+
import type { HookAPI, HookContext } from "@bastani/atomic";
|
|
2716
2736
|
export default function (pi: HookAPI) { ... }
|
|
2717
2737
|
|
|
2718
2738
|
// Before (custom tool)
|
|
2719
|
-
import type { CustomToolFactory } from "@
|
|
2739
|
+
import type { CustomToolFactory } from "@bastani/atomic";
|
|
2720
2740
|
const factory: CustomToolFactory = (pi) => ({ name: "my_tool", ... });
|
|
2721
2741
|
export default factory;
|
|
2722
2742
|
|
|
2723
2743
|
// After (both are now extensions)
|
|
2724
|
-
import type { ExtensionAPI } from "@
|
|
2744
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
2725
2745
|
export default function (pi: ExtensionAPI) {
|
|
2726
2746
|
pi.on("tool_call", async (event, ctx) => { ... });
|
|
2727
2747
|
pi.registerTool({ name: "my_tool", ... });
|
|
@@ -3164,7 +3184,7 @@ See [docs/custom-tools.md](docs/custom-tools.md) and [examples/custom-tools/](ex
|
|
|
3164
3184
|
import {
|
|
3165
3185
|
discoverAuthStorage,
|
|
3166
3186
|
discoverModels,
|
|
3167
|
-
} from "@
|
|
3187
|
+
} from "@bastani/atomic";
|
|
3168
3188
|
|
|
3169
3189
|
const authStorage = discoverAuthStorage(); // ~/.pi/agent/auth.json
|
|
3170
3190
|
const modelRegistry = discoverModels(authStorage); // + ~/.pi/agent/models.json
|
|
@@ -3562,7 +3582,7 @@ Total color count increased from 46 to 50. See [docs/themes.md](docs/themes.md)
|
|
|
3562
3582
|
|
|
3563
3583
|
### Added
|
|
3564
3584
|
|
|
3565
|
-
- **OAuth and model config exports**: Scripts using `AgentSession` directly can now import `getAvailableModels`, `getApiKeyForModel`, `findModel`, `login`, `logout`, and `getOAuthProviders` from `@
|
|
3585
|
+
- **OAuth and model config exports**: Scripts using `AgentSession` directly can now import `getAvailableModels`, `getApiKeyForModel`, `findModel`, `login`, `logout`, and `getOAuthProviders` from `@bastani/atomic` to reuse OAuth token storage and model resolution. ([#245](https://github.com/badlogic/pi-mono/issues/245))
|
|
3566
3586
|
|
|
3567
3587
|
- **xhigh thinking level for gpt-5.2 models**: The thinking level selector and shift+tab cycling now show xhigh option for gpt-5.2 and gpt-5.2-codex models (in addition to gpt-5.1-codex-max). ([#236](https://github.com/badlogic/pi-mono/pull/236) by [@theBucky](https://github.com/theBucky))
|
|
3568
3588
|
|
|
@@ -3588,7 +3608,7 @@ Total color count increased from 46 to 50. See [docs/themes.md](docs/themes.md)
|
|
|
3588
3608
|
|
|
3589
3609
|
- **Subagent orchestration example**: Added comprehensive custom tool example for spawning and orchestrating sub-agents with isolated context windows. Includes scout/planner/reviewer/worker agents and workflow commands for multi-agent pipelines. ([#215](https://github.com/badlogic/pi-mono/pull/215) by [@nicobailon](https://github.com/nicobailon))
|
|
3590
3610
|
|
|
3591
|
-
- **`getMarkdownTheme()` export**: Custom tools can now import `getMarkdownTheme()` from `@
|
|
3611
|
+
- **`getMarkdownTheme()` export**: Custom tools can now import `getMarkdownTheme()` from `@bastani/atomic` to use the same markdown styling as the main UI.
|
|
3592
3612
|
|
|
3593
3613
|
- **`pi.exec()` signal and timeout support**: Custom tools and hooks can now pass `{ signal, timeout }` options to `pi.exec()` for cancellation and timeout handling. The result includes a `killed` flag when the process was terminated.
|
|
3594
3614
|
|
|
@@ -3660,7 +3680,7 @@ Total color count increased from 46 to 50. See [docs/themes.md](docs/themes.md)
|
|
|
3660
3680
|
- `rpc.md`: Added missing `hook_error` event documentation
|
|
3661
3681
|
- `README.md`: Complete settings table, condensed philosophy section, standardized OAuth docs
|
|
3662
3682
|
|
|
3663
|
-
- Hooks loader now supports same import aliases as custom tools (`@sinclair/typebox`, `@mariozechner/pi-ai`, `@mariozechner/pi-tui`, `@
|
|
3683
|
+
- Hooks loader now supports same import aliases as custom tools (`@sinclair/typebox`, `@mariozechner/pi-ai`, `@mariozechner/pi-tui`, `@bastani/atomic`).
|
|
3664
3684
|
|
|
3665
3685
|
### Breaking Changes
|
|
3666
3686
|
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</p>
|
|
8
8
|
<p align="center">
|
|
9
9
|
<a href="https://discord.com/invite/3cU7Bz4UPx"><img alt="Discord" src="https://img.shields.io/badge/discord-community-5865F2?style=flat-square&logo=discord&logoColor=white" /></a>
|
|
10
|
-
<a href="https://www.npmjs.com/package/@
|
|
10
|
+
<a href="https://www.npmjs.com/package/@bastani/atomic"><img alt="npm" src="https://img.shields.io/npm/v/@bastani/atomic?style=flat-square" /></a>
|
|
11
11
|
</p>
|
|
12
12
|
<p align="center">
|
|
13
13
|
<a href="https://pi.dev">pi.dev</a> domain graciously donated by
|
|
@@ -76,7 +76,7 @@ curl -fsSL https://pi.dev/install.sh | sh
|
|
|
76
76
|
Or with npm:
|
|
77
77
|
|
|
78
78
|
```bash
|
|
79
|
-
npm install -g @
|
|
79
|
+
npm install -g @bastani/atomic
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
Authenticate with an API key:
|
|
@@ -436,7 +436,7 @@ See [docs/packages.md](docs/packages.md).
|
|
|
436
436
|
### SDK
|
|
437
437
|
|
|
438
438
|
```typescript
|
|
439
|
-
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@
|
|
439
|
+
import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@bastani/atomic";
|
|
440
440
|
|
|
441
441
|
const authStorage = AuthStorage.create();
|
|
442
442
|
const modelRegistry = ModelRegistry.create(authStorage);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
2
2
|
import { randomUUID } from "crypto";
|
|
3
3
|
import { Type } from "typebox";
|
|
4
4
|
import { Text } from "@mariozechner/pi-tui";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/intercom",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension providing a private coordination channel between parent and child agent sessions.",
|
|
6
6
|
"contributors": [
|
|
@@ -39,16 +39,12 @@
|
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@bastani/atomic": "*",
|
|
42
|
-
"@earendil-works/pi-coding-agent": "*",
|
|
43
42
|
"@earendil-works/pi-tui": "*"
|
|
44
43
|
},
|
|
45
44
|
"peerDependenciesMeta": {
|
|
46
45
|
"@bastani/atomic": {
|
|
47
46
|
"optional": true
|
|
48
47
|
},
|
|
49
|
-
"@earendil-works/pi-coding-agent": {
|
|
50
|
-
"optional": true
|
|
51
|
-
},
|
|
52
48
|
"@earendil-works/pi-tui": {
|
|
53
49
|
"optional": true
|
|
54
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component, TUI } from "@mariozechner/pi-tui";
|
|
2
2
|
import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
|
|
3
|
-
import type { KeybindingsManager, Theme } from "@
|
|
3
|
+
import type { KeybindingsManager, Theme } from "@bastani/atomic";
|
|
4
4
|
import type { IntercomClient } from "../broker/client.js";
|
|
5
5
|
import type { SessionInfo } from "../types.js";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component } from "@mariozechner/pi-tui";
|
|
2
2
|
import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@mariozechner/pi-tui";
|
|
3
|
-
import type { Theme } from "@
|
|
3
|
+
import type { Theme } from "@bastani/atomic";
|
|
4
4
|
import type { SessionInfo, Message } from "../types.js";
|
|
5
5
|
|
|
6
6
|
export class InlineMessageComponent implements Component {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component } from "@mariozechner/pi-tui";
|
|
2
2
|
import { truncateToWidth, visibleWidth } from "@mariozechner/pi-tui";
|
|
3
|
-
import type { KeybindingsManager, Theme } from "@
|
|
3
|
+
import type { KeybindingsManager, Theme } from "@bastani/atomic";
|
|
4
4
|
import type { SessionInfo } from "../types.js";
|
|
5
5
|
|
|
6
6
|
function middleTruncate(text: string, maxWidth: number): string {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
2
2
|
import type { McpExtensionState } from "./state.ts";
|
|
3
3
|
import type { McpAuthResult, McpConfig, ServerEntry, McpPanelCallbacks, McpPanelResult, ImportKind } from "./types.ts";
|
|
4
4
|
import {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentToolResult, AgentToolUpdateCallback, ExtensionContext } from "@
|
|
1
|
+
import type { AgentToolResult, AgentToolUpdateCallback, ExtensionContext } from "@bastani/atomic";
|
|
2
2
|
import type { McpExtensionState } from "./state.ts";
|
|
3
3
|
import type { DirectToolSpec, McpConfig, McpContent } from "./types.ts";
|
|
4
4
|
import type { MetadataCache } from "./metadata-cache.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI, ToolInfo } from "@
|
|
1
|
+
import type { ExtensionAPI, ToolInfo } from "@bastani/atomic";
|
|
2
2
|
import type { McpExtensionState } from "./state.ts";
|
|
3
3
|
import { Type } from "typebox";
|
|
4
4
|
import { showStatus, showTools, reconnectServers, authenticateServer, logoutServer, openMcpAuthPanel, openMcpPanel, openMcpSetup } from "./commands.ts";
|
package/dist/builtin/mcp/init.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
2
2
|
import type { McpExtensionState } from "./state.ts";
|
|
3
3
|
import type { ToolMetadata } from "./types.ts";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/mcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension that adapts MCP (Model Context Protocol) servers into the coding agent.",
|
|
6
6
|
"contributors": [
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@bastani/atomic": "*",
|
|
35
35
|
"@earendil-works/pi-ai": "*",
|
|
36
|
-
"@earendil-works/pi-coding-agent": "*",
|
|
37
36
|
"@earendil-works/pi-tui": "*",
|
|
38
37
|
"zod": "^3.25.0 || ^4.0.0"
|
|
39
38
|
},
|
|
@@ -44,9 +43,6 @@
|
|
|
44
43
|
"@earendil-works/pi-ai": {
|
|
45
44
|
"optional": true
|
|
46
45
|
},
|
|
47
|
-
"@earendil-works/pi-coding-agent": {
|
|
48
|
-
"optional": true
|
|
49
|
-
},
|
|
50
46
|
"@earendil-works/pi-tui": {
|
|
51
47
|
"optional": true
|
|
52
48
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentToolResult, ToolInfo } from "@
|
|
1
|
+
import type { AgentToolResult, ToolInfo } from "@bastani/atomic";
|
|
2
2
|
import type { McpExtensionState } from "./state.ts";
|
|
3
3
|
import type { ToolMetadata, McpContent } from "./types.ts";
|
|
4
4
|
import { getServerPrefix, parseUiPromptHandoff } from "./types.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { complete, type Api, type AssistantMessage, type Message, type Model, type TextContent } from "@earendil-works/pi-ai";
|
|
2
2
|
import { truncateAtWord } from "./utils.ts";
|
|
3
|
-
import type { ExtensionUIContext, ModelRegistry } from "@
|
|
3
|
+
import type { ExtensionUIContext, ModelRegistry } from "@bastani/atomic";
|
|
4
4
|
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
5
5
|
import {
|
|
6
6
|
CreateMessageRequestSchema,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionContext } from "@
|
|
1
|
+
import type { ExtensionContext } from "@bastani/atomic";
|
|
2
2
|
import type { ConsentManager } from "./consent-manager.ts";
|
|
3
3
|
import type { McpLifecycleManager } from "./lifecycle.ts";
|
|
4
4
|
import type { McpServerManager } from "./server-manager.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentToolResult, ToolRenderResultOptions } from "@
|
|
1
|
+
import type { AgentToolResult, ToolRenderResultOptions } from "@bastani/atomic";
|
|
2
2
|
import { Text } from "@earendil-works/pi-tui";
|
|
3
3
|
|
|
4
4
|
type McpToolResultDetails = Record<string, unknown> & { error?: unknown };
|
|
@@ -370,7 +370,7 @@
|
|
|
370
370
|
- Worktree cwd mapping now derives repo-relative prefixes from `git rev-parse --show-prefix` instead of `path.relative(realpath, realpath)`, fixing Windows 8.3/canonical-path mismatches that could map `agentCwd` back to the source repo instead of the created worktree.
|
|
371
371
|
- Async background runs now pass the parent process `argv[1]` through to the detached runner, so Windows child spawning keeps targeting the intended `pi` CLI entry point instead of accidentally treating the runner's `jiti` bootstrap script as `pi`.
|
|
372
372
|
- Intercom detach listeners now guard optional event-bus subscriptions with optional-call semantics, so delegated runs no longer fail when host event buses expose `emit` without `on`.
|
|
373
|
-
- Skill discovery no longer depends on runtime imports from `@
|
|
373
|
+
- Skill discovery no longer depends on runtime imports from `@bastani/atomic`; it now resolves skills directly from configured filesystem paths, preventing `ERR_MODULE_NOT_FOUND` crashes in local/integration test environments.
|
|
374
374
|
|
|
375
375
|
## [0.13.3] - 2026-04-13
|
|
376
376
|
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
## [0.12.2] - 2026-04-04
|
|
435
435
|
|
|
436
436
|
### Changed
|
|
437
|
-
- Bumped pi package devDependencies to `^0.65.0` (`@mariozechner/pi-agent-core`, `@mariozechner/pi-ai`, `@
|
|
437
|
+
- Bumped pi package devDependencies to `^0.65.0` (`@mariozechner/pi-agent-core`, `@mariozechner/pi-ai`, `@bastani/atomic`) to stay aligned with current pi SDK/runtime.
|
|
438
438
|
|
|
439
439
|
## [0.12.1] - 2026-04-03
|
|
440
440
|
|
|
@@ -638,7 +638,7 @@
|
|
|
638
638
|
- **`"builtin"` agent source** — new third tier in agent discovery. Priority: builtin < user < project. Builtin agents appear in listings with a `[builtin]` badge and cannot be modified or deleted through management actions (create a same-named user agent to override instead).
|
|
639
639
|
|
|
640
640
|
### Fixed
|
|
641
|
-
- Async subagent session sharing no longer fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`. The runner tried `require.resolve("@
|
|
641
|
+
- Async subagent session sharing no longer fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`. The runner tried `require.resolve("@bastani/atomic/package.json")` to find pi's HTML export module, but pi's `exports` map doesn't include that subpath. The fix resolves the package root in the main pi process by walking up from `process.argv[1]` and passes it to the spawned runner through the config, bypassing `require.resolve` entirely. The Windows CLI resolution fallback in `getPiSpawnCommand` benefits from the same walk-up function.
|
|
642
642
|
|
|
643
643
|
## [0.8.5] - 2026-02-16
|
|
644
644
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/subagents",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for delegating tasks to subagents with chains, parallel execution, and TUI clarification.",
|
|
6
6
|
"contributors": [
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@bastani/atomic": "*",
|
|
41
41
|
"@earendil-works/pi-agent-core": "*",
|
|
42
42
|
"@earendil-works/pi-ai": "*",
|
|
43
|
-
"@earendil-works/pi-coding-agent": "*",
|
|
44
43
|
"@earendil-works/pi-tui": "*"
|
|
45
44
|
},
|
|
46
45
|
"peerDependenciesMeta": {
|
|
@@ -53,9 +52,6 @@
|
|
|
53
52
|
"@earendil-works/pi-ai": {
|
|
54
53
|
"optional": true
|
|
55
54
|
},
|
|
56
|
-
"@earendil-works/pi-coding-agent": {
|
|
57
|
-
"optional": true
|
|
58
|
-
},
|
|
59
55
|
"@earendil-works/pi-tui": {
|
|
60
56
|
"optional": true
|
|
61
57
|
}
|
|
@@ -2,7 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { CONFIG_DIR_NAME } from "@bastani/atomic";
|
|
4
4
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
5
|
-
import type { ExtensionContext } from "@
|
|
5
|
+
import type { ExtensionContext } from "@bastani/atomic";
|
|
6
6
|
import {
|
|
7
7
|
type AgentConfig,
|
|
8
8
|
type AgentScope,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@
|
|
1
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
2
2
|
import { controlNotificationKey, formatControlNoticeMessage } from "../runs/shared/subagent-control.ts";
|
|
3
3
|
import type { ControlEvent, SubagentState } from "../shared/types.ts";
|
|
4
4
|
|
|
@@ -17,7 +17,7 @@ import * as os from "node:os";
|
|
|
17
17
|
import * as path from "node:path";
|
|
18
18
|
import { getAgentConfigPaths, getEnvValue } from "@bastani/atomic";
|
|
19
19
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
20
|
-
import { type ExtensionAPI, type ExtensionContext, type ToolDefinition } from "@
|
|
20
|
+
import { type ExtensionAPI, type ExtensionContext, type ToolDefinition } from "@bastani/atomic";
|
|
21
21
|
import { Box, Container, Spacer, Text, truncateToWidth, visibleWidth, wrapTextWithAnsi, type Component } from "@earendil-works/pi-tui";
|
|
22
22
|
import { discoverAgents } from "../agents/agents.ts";
|
|
23
23
|
import { cleanupAllArtifactDirs, cleanupOldArtifacts, getArtifactsDir } from "../shared/artifacts.ts";
|
|
@@ -8,7 +8,7 @@ import * as os from "node:os";
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
|
-
import type { ExtensionAPI } from "@
|
|
11
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
12
12
|
import type { AgentConfig } from "../../agents/agents.ts";
|
|
13
13
|
import { applyThinkingSuffix } from "../shared/pi-args.ts";
|
|
14
14
|
import { injectSingleOutputInstruction, resolveSingleOutputPath, validateFileOnlyOutputMode } from "../shared/single-output.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
1
|
+
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { renderWidget } from "../../tui/render.ts";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Subagent completion notifications.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { ExtensionAPI } from "@
|
|
5
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
6
6
|
import { buildCompletionKey, getGlobalSeenMap, markSeenWithTtl } from "./completion-dedupe.ts";
|
|
7
7
|
import { SUBAGENT_ASYNC_COMPLETE_EVENT } from "../../shared/types.ts";
|
|
8
8
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Supports runtime editing of templates, output paths, reads lists, and progress toggle.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { Theme } from "@
|
|
8
|
+
import type { Theme } from "@bastani/atomic";
|
|
9
9
|
import type { Component, TUI } from "@earendil-works/pi-tui";
|
|
10
10
|
import { matchesKey, visibleWidth, truncateToWidth } from "@earendil-works/pi-tui";
|
|
11
11
|
import type { AgentConfig } from "../../agents/agents.ts";
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
7
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
8
|
-
import type { ExtensionContext } from "@
|
|
8
|
+
import type { ExtensionContext } from "@bastani/atomic";
|
|
9
9
|
import type { AgentConfig } from "../../agents/agents.ts";
|
|
10
10
|
import { ChainClarifyComponent, type ChainClarifyResult, type BehaviorOverride } from "./chain-clarify.ts";
|
|
11
11
|
import { toModelInfo, type ModelInfo } from "../../shared/model-info.ts";
|
|
@@ -2,7 +2,7 @@ import { randomUUID } from "node:crypto";
|
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
5
|
-
import type { ExtensionAPI, ExtensionContext } from "@
|
|
5
|
+
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
6
6
|
import { type AgentConfig, type AgentScope } from "../../agents/agents.ts";
|
|
7
7
|
import { getArtifactsDir } from "../../shared/artifacts.ts";
|
|
8
8
|
import { ChainClarifyComponent, type ChainClarifyResult } from "./chain-clarify.ts";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { APP_NAME, PACKAGE_NAME } from "@bastani/atomic";
|
|
4
5
|
|
|
5
|
-
export const
|
|
6
|
+
export const CODING_AGENT_PACKAGE = PACKAGE_NAME;
|
|
7
|
+
export const PI_CODING_AGENT_PACKAGE = CODING_AGENT_PACKAGE;
|
|
6
8
|
|
|
7
9
|
export function findPiPackageRootFromEntry(entryPoint: string): string | undefined {
|
|
8
10
|
let dir = path.dirname(entryPoint);
|
|
@@ -10,7 +12,7 @@ export function findPiPackageRootFromEntry(entryPoint: string): string | undefin
|
|
|
10
12
|
const packageJsonPath = path.join(dir, "package.json");
|
|
11
13
|
if (fs.existsSync(packageJsonPath)) {
|
|
12
14
|
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")) as { name?: unknown };
|
|
13
|
-
if (pkg.name ===
|
|
15
|
+
if (pkg.name === CODING_AGENT_PACKAGE) return dir;
|
|
14
16
|
}
|
|
15
17
|
dir = path.dirname(dir);
|
|
16
18
|
}
|
|
@@ -18,7 +20,7 @@ export function findPiPackageRootFromEntry(entryPoint: string): string | undefin
|
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export function resolveInstalledPiPackageRoot(): string | undefined {
|
|
21
|
-
return findPiPackageRootFromEntry(fileURLToPath(import.meta.resolve(
|
|
23
|
+
return findPiPackageRootFromEntry(fileURLToPath(import.meta.resolve(CODING_AGENT_PACKAGE)));
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
export function resolvePiPackageRoot(): string | undefined {
|
|
@@ -56,7 +58,7 @@ function normalizePath(filePath: string): string {
|
|
|
56
58
|
return path.isAbsolute(filePath) ? filePath : path.resolve(filePath);
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
export function
|
|
61
|
+
export function resolvePiCliScript(deps: PiSpawnDeps = {}): string | undefined {
|
|
60
62
|
const existsSync = deps.existsSync ?? fs.existsSync;
|
|
61
63
|
const readFileSync = deps.readFileSync ?? ((filePath, encoding) => fs.readFileSync(filePath, encoding));
|
|
62
64
|
const argv1 = deps.argv1 ?? process.argv[1];
|
|
@@ -75,7 +77,7 @@ export function resolveWindowsPiCliScript(deps: PiSpawnDeps = {}): string | unde
|
|
|
75
77
|
const packageRoot = deps.resolvePackageEntry
|
|
76
78
|
? findPiPackageRootFromEntry(deps.resolvePackageEntry())
|
|
77
79
|
: resolveInstalledPiPackageRoot();
|
|
78
|
-
if (!packageRoot) throw new Error(`Could not resolve ${
|
|
80
|
+
if (!packageRoot) throw new Error(`Could not resolve ${CODING_AGENT_PACKAGE} package root`);
|
|
79
81
|
return path.join(packageRoot, "package.json");
|
|
80
82
|
});
|
|
81
83
|
const packageJsonPath = resolvePackageJson();
|
|
@@ -85,31 +87,32 @@ export function resolveWindowsPiCliScript(deps: PiSpawnDeps = {}): string | unde
|
|
|
85
87
|
const binField = packageJson.bin;
|
|
86
88
|
const binPath = typeof binField === "string"
|
|
87
89
|
? binField
|
|
88
|
-
: binField?.pi ?? Object.values(binField ?? {})[0];
|
|
90
|
+
: binField?.[APP_NAME] ?? binField?.pi ?? Object.values(binField ?? {})[0];
|
|
89
91
|
if (!binPath) return undefined;
|
|
90
92
|
const candidate = path.resolve(path.dirname(packageJsonPath), binPath);
|
|
91
93
|
if (isRunnableNodeScript(candidate, existsSync)) {
|
|
92
94
|
return candidate;
|
|
93
95
|
}
|
|
94
96
|
} catch {
|
|
95
|
-
//
|
|
97
|
+
// CLI script resolution is optional; falling back to the app command lets PATH handle execution.
|
|
96
98
|
return undefined;
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
return undefined;
|
|
100
102
|
}
|
|
101
103
|
|
|
104
|
+
export function resolveWindowsPiCliScript(deps: PiSpawnDeps = {}): string | undefined {
|
|
105
|
+
return resolvePiCliScript(deps);
|
|
106
|
+
}
|
|
107
|
+
|
|
102
108
|
export function getPiSpawnCommand(args: string[], deps: PiSpawnDeps = {}): PiSpawnCommand {
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
args: [piCliPath, ...args],
|
|
110
|
-
};
|
|
111
|
-
}
|
|
109
|
+
const cliPath = resolvePiCliScript(deps);
|
|
110
|
+
if (cliPath) {
|
|
111
|
+
return {
|
|
112
|
+
command: deps.execPath ?? process.execPath,
|
|
113
|
+
args: [cliPath, ...args],
|
|
114
|
+
};
|
|
112
115
|
}
|
|
113
116
|
|
|
114
|
-
return { command:
|
|
117
|
+
return { command: APP_NAME, args };
|
|
115
118
|
}
|
|
@@ -6,7 +6,7 @@ import * as os from "node:os";
|
|
|
6
6
|
import * as path from "node:path";
|
|
7
7
|
import type { Message } from "@earendil-works/pi-ai";
|
|
8
8
|
import type { FSWatcher } from "node:fs";
|
|
9
|
-
import type { ExtensionContext } from "@
|
|
9
|
+
import type { ExtensionContext } from "@bastani/atomic";
|
|
10
10
|
import { APP_NAME, getEnvValue } from "@bastani/atomic";
|
|
11
11
|
|
|
12
12
|
const ENV_PREFIX = APP_NAME.toUpperCase();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
2
|
-
import type { ExtensionContext } from "@
|
|
2
|
+
import type { ExtensionContext } from "@bastani/atomic";
|
|
3
3
|
import type { SubagentParamsLike } from "../runs/foreground/subagent-executor.ts";
|
|
4
4
|
import {
|
|
5
5
|
SLASH_SUBAGENT_CANCEL_EVENT,
|