@selesai/code 0.2.1 → 0.3.1
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/dist/config.d.ts +4 -15
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -45
- package/dist/config.js.map +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 +8 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/diagnostics.d.ts +1 -0
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/diagnostics.js.map +1 -1
- package/dist/core/model-registry.d.ts +4 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +101 -51
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/package-manager.d.ts +10 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +93 -8
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/package-manager.test.d.ts +2 -0
- package/dist/core/package-manager.test.d.ts.map +1 -0
- package/dist/core/package-manager.test.js +20 -0
- package/dist/core/package-manager.test.js.map +1 -0
- package/dist/core/resource-loader.d.ts +3 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +10 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/defaults/models.json +64 -113
- package/dist/extensions/caveman/caveman-instructions.cjs +39 -0
- package/dist/extensions/caveman/index.js +116 -0
- package/dist/extensions/caveman/package.json +8 -0
- package/dist/extensions/caveman/test/extension.test.js +185 -0
- package/dist/extensions/caveman/test/helpers.test.js +67 -0
- package/dist/extensions/copy-turn.ts +2 -2
- package/dist/extensions/pi-intercom/broker/broker.ts +2 -3
- package/dist/extensions/pi-intercom/broker/paths.ts +10 -5
- package/dist/extensions/pi-intercom/broker/spawn.ts +2 -3
- package/dist/extensions/pi-intercom/config.ts +2 -2
- package/dist/extensions/pi-intercom/index.ts +2 -2
- package/dist/extensions/pi-intercom/package.json +2 -2
- package/dist/extensions/pi-intercom/ui/compose.ts +3 -3
- package/dist/extensions/pi-intercom/ui/inline-message.ts +3 -3
- package/dist/extensions/pi-intercom/ui/session-list.ts +3 -3
- package/dist/extensions/pi-powerline-footer/bash-mode/editor.ts +2 -2
- package/dist/extensions/pi-powerline-footer/bash-mode/history.ts +2 -1
- package/dist/extensions/pi-powerline-footer/index.ts +40 -47
- package/dist/extensions/pi-powerline-footer/package.json +2 -2
- package/dist/extensions/pi-powerline-footer/tests/bash-mode.test.ts +10 -10
- package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +1 -1
- package/dist/extensions/pi-powerline-footer/tests/working-vibes.test.ts +2 -2
- package/dist/extensions/pi-powerline-footer/theme.ts +6 -6
- package/dist/extensions/pi-powerline-footer/tps.ts +1 -1
- package/dist/extensions/pi-powerline-footer/types.ts +7 -7
- package/dist/extensions/pi-powerline-footer/welcome.ts +23 -16
- package/dist/extensions/pi-powerline-footer/working-vibes.ts +52 -59
- package/dist/extensions/pi-rewind-hook/index.ts +1 -1
- package/dist/extensions/pi-rewind-hook/package.json +1 -1
- package/dist/extensions/pi-subagents/README.md +224 -52
- package/dist/extensions/pi-subagents/agents/architect.md +188 -0
- package/dist/extensions/pi-subagents/agents/builder.md +120 -0
- package/dist/extensions/pi-subagents/agents/commentator.md +131 -0
- package/dist/extensions/pi-subagents/agents/explorer.md +51 -0
- package/dist/extensions/pi-subagents/agents/recapper.md +21 -0
- package/dist/extensions/pi-subagents/install.mjs +93 -0
- package/dist/extensions/pi-subagents/package.json +4 -5
- package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +1 -1
- package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +76 -13
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +179 -2
- package/dist/extensions/pi-subagents/src/agents/agent-memory.ts +254 -0
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +11 -0
- package/dist/extensions/pi-subagents/src/agents/agents.ts +193 -19
- package/dist/extensions/pi-subagents/src/agents/chain-serializer.ts +27 -2
- package/dist/extensions/pi-subagents/src/extension/config.ts +27 -4
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +1 -7
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +3 -2
- package/dist/extensions/pi-subagents/src/extension/index.ts +73 -71
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +369 -0
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +54 -10
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +200 -0
- package/dist/extensions/pi-subagents/src/intercom/intercom-bridge.ts +21 -253
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +519 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +195 -105
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +88 -2
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +67 -10
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +34 -4
- package/dist/extensions/pi-subagents/src/runs/background/completion-batcher.ts +166 -0
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +156 -1
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +515 -0
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +161 -44
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +1 -2
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +3 -2
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +167 -6
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +514 -0
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +28 -1
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +873 -204
- package/dist/extensions/pi-subagents/src/runs/background/wait.ts +353 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +123 -27
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +174 -70
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +569 -81
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +45 -22
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +172 -21
- package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +128 -0
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +89 -0
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +50 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +35 -4
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +63 -45
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +125 -5
- package/dist/extensions/pi-subagents/src/runs/shared/tool-budget.ts +74 -0
- package/dist/extensions/pi-subagents/src/runs/shared/turn-budget.ts +52 -0
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +28 -5
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +16 -1
- package/dist/extensions/pi-subagents/src/shared/atomic-json.ts +15 -2
- package/dist/extensions/pi-subagents/src/shared/child-transcript.ts +212 -0
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +133 -22
- package/dist/extensions/pi-subagents/src/shared/settings.ts +3 -1
- package/dist/extensions/pi-subagents/src/shared/types.ts +197 -4
- package/dist/extensions/pi-subagents/src/shared/utils.ts +108 -17
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +330 -0
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +135 -4
- package/dist/extensions/pi-subagents/src/tui/render.ts +32 -12
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +2772 -0
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +1107 -0
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +463 -0
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +274 -0
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +1535 -0
- package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +242 -0
- package/dist/extensions/pi-subagents/test/integration/doctor-executor.test.ts +128 -0
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +252 -0
- package/dist/extensions/pi-subagents/test/integration/foreground-result-size.test.ts +188 -0
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +1306 -0
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +1033 -0
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +397 -0
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +583 -0
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +691 -0
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +892 -0
- package/dist/extensions/pi-subagents/test/integration/session-tokens.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +1824 -0
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +1284 -0
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +127 -0
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +299 -0
- package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +37 -0
- package/dist/extensions/pi-subagents/test/support/helpers.ts +189 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +335 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +129 -0
- package/dist/extensions/pi-subagents/test/support/real-session-child-cli.mjs +184 -0
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +285 -0
- package/dist/extensions/pi-subagents/test/support/register-loader.mjs +15 -0
- package/dist/extensions/pi-subagents/test/support/ts-loader.mjs +108 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +421 -0
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +213 -0
- package/dist/extensions/pi-subagents/test/unit/agent-eject-disable.test.ts +343 -0
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +1199 -0
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +556 -0
- package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +420 -0
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +579 -0
- package/dist/extensions/pi-subagents/test/unit/agent-scope.test.ts +20 -0
- package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +88 -0
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +86 -0
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +221 -0
- package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +98 -0
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +285 -0
- package/dist/extensions/pi-subagents/test/unit/atomic-json.test.ts +112 -0
- package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +206 -0
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +159 -0
- package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +229 -0
- package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +225 -0
- package/dist/extensions/pi-subagents/test/unit/close-grace-timer.test.ts +101 -0
- package/dist/extensions/pi-subagents/test/unit/completion-batcher.test.ts +228 -0
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +36 -0
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +152 -0
- package/dist/extensions/pi-subagents/test/unit/config-dir-runtime.test.ts +72 -0
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +327 -0
- package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +161 -0
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +159 -0
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +217 -0
- package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +88 -0
- package/dist/extensions/pi-subagents/test/unit/file-coalescer.test.ts +68 -0
- package/dist/extensions/pi-subagents/test/unit/foreground-tool-call-compaction.test.ts +78 -0
- package/dist/extensions/pi-subagents/test/unit/fork-context.test.ts +415 -0
- package/dist/extensions/pi-subagents/test/unit/get-final-output.test.ts +126 -0
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +271 -0
- package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +173 -0
- package/dist/extensions/pi-subagents/test/unit/jsonl-writer.test.ts +119 -0
- package/dist/extensions/pi-subagents/test/unit/live-async-resume.test.ts +170 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +346 -0
- package/dist/extensions/pi-subagents/test/unit/model-info.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +87 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +145 -0
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +162 -0
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +470 -0
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +329 -0
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +319 -0
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +70 -0
- package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +247 -0
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +113 -0
- package/dist/extensions/pi-subagents/test/unit/path-resolution.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +803 -0
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +209 -0
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +238 -0
- package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +118 -0
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +299 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +408 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +134 -0
- package/dist/extensions/pi-subagents/test/unit/recursion-guard.test.ts +257 -0
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +209 -0
- package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +226 -0
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +294 -0
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +147 -0
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +997 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +478 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +562 -0
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +213 -0
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +438 -0
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +54 -0
- package/dist/extensions/pi-subagents/test/unit/slash-chain-groups.test.ts +464 -0
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +255 -0
- package/dist/extensions/pi-subagents/test/unit/status-format.test.ts +19 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +245 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +517 -0
- package/dist/extensions/pi-subagents/test/unit/temp-paths.test.ts +72 -0
- package/dist/extensions/pi-subagents/test/unit/tool-budget.test.ts +52 -0
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +237 -0
- package/dist/extensions/pi-subagents/test/unit/total-cost.test.ts +60 -0
- package/dist/extensions/pi-subagents/test/unit/ts-loader.test.ts +33 -0
- package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +202 -0
- package/dist/extensions/pi-subagents/test/unit/types-fork-preamble.test.ts +23 -0
- package/dist/extensions/pi-subagents/test/unit/wait.test.ts +398 -0
- package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +88 -0
- package/dist/extensions/pi-subagents/test/unit/windows-hide-spawn.test.ts +26 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +134 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +479 -0
- package/dist/extensions/pi-web-agent/package.json +2 -2
- package/dist/extensions/pi-web-agent/src/backends/settings-reader.ts +2 -2
- package/dist/extensions/pi-web-agent/src/changelog-notice.ts +5 -2
- package/dist/extensions/pi-web-agent/src/commands/web-agent-config.ts +1 -1
- package/dist/extensions/pi-web-agent/src/extension.ts +1 -1
- package/dist/extensions/pi-web-agent/src/presentation/config-store.ts +6 -4
- package/dist/extensions/question/helpers.ts +3 -3
- package/dist/extensions/question/index.ts +2 -2
- package/dist/extensions/question/navigation.ts +2 -2
- package/dist/extensions/question/package.json +2 -2
- package/dist/extensions/question/question-list.ts +2 -2
- package/dist/extensions/question/tests/question-list.test.ts +2 -2
- package/dist/extensions/question/tui-adapter.ts +2 -2
- package/dist/extensions/question/types.ts +2 -2
- package/dist/extensions/question/ui-protocol.ts +2 -2
- package/dist/extensions/rtk.ts +2 -2
- package/dist/extensions/tokenin-onboarding.ts +2 -2
- package/dist/extensions/undo.ts +1 -1
- package/dist/extensions/web-agent-onboarding.ts +3 -3
- package/dist/extensions/workflow/adapter.ts +16 -8
- package/dist/extensions/workflow/extension.ts +1 -1
- package/dist/extensions/workflow/package.json +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +2 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +19 -5
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/skills/caveman/SKILL.md +49 -0
- package/dist/skills/handoff-text/SKILL.md +13 -0
- package/dist/utils/thinking-tags.d.ts +7 -0
- package/dist/utils/thinking-tags.d.ts.map +1 -0
- package/dist/utils/thinking-tags.js +63 -0
- package/dist/utils/thinking-tags.js.map +1 -0
- package/docs/docs.json +4 -0
- package/docs/extensions.md +2 -0
- package/docs/settings.md +15 -0
- package/docs/shared-host-extensions.md +109 -0
- package/package.json +2 -2
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
copyToClipboard,
|
|
3
|
+
CONFIG_DIR_NAME,
|
|
4
|
+
getAgentDir,
|
|
5
|
+
getSettingsPath,
|
|
3
6
|
type ExtensionAPI,
|
|
4
7
|
type ReadonlyFooterDataProvider,
|
|
5
8
|
type Theme,
|
|
6
|
-
} from "@
|
|
9
|
+
} from "@selesai/code";
|
|
7
10
|
import type { AssistantMessage } from "@earendil-works/pi-ai";
|
|
8
11
|
import { isKeyRelease, matchesKey, type AutocompleteProvider, type SelectItem, SelectList, truncateToWidth, TUI_KEYBINDINGS, visibleWidth } from "@earendil-works/pi-tui";
|
|
9
12
|
import { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync } from "node:fs";
|
|
10
13
|
import { join, dirname } from "node:path";
|
|
11
|
-
import { homedir } from "node:os";
|
|
12
14
|
|
|
13
15
|
import type { ColorScheme, SegmentContext, StatusLinePreset, StatusLineSegmentId } from "./types.ts";
|
|
14
16
|
import type { PowerlineConfig } from "./powerline-config.ts";
|
|
@@ -44,9 +46,9 @@ import {
|
|
|
44
46
|
shortcutUsesSuper,
|
|
45
47
|
} from "./shortcuts.ts";
|
|
46
48
|
import {
|
|
47
|
-
initVibeManager,
|
|
48
|
-
onVibeBeforeAgentStart,
|
|
49
|
-
onVibeAgentStart,
|
|
49
|
+
initVibeManager,
|
|
50
|
+
onVibeBeforeAgentStart,
|
|
51
|
+
onVibeAgentStart,
|
|
50
52
|
onVibeAgentEnd,
|
|
51
53
|
onVibeToolCall,
|
|
52
54
|
getVibeTheme,
|
|
@@ -324,23 +326,16 @@ function trackPromptHistory(editor: any): void {
|
|
|
324
326
|
snapshotPromptHistory(editor);
|
|
325
327
|
}
|
|
326
328
|
|
|
327
|
-
function getSettingsPath(): string {
|
|
328
|
-
const homeDir = process.env.HOME || process.env.USERPROFILE || homedir();
|
|
329
|
-
return join(homeDir, ".pi", "agent", "settings.json");
|
|
330
|
-
}
|
|
331
|
-
|
|
332
329
|
function getProjectSettingsPath(cwd: string): string {
|
|
333
|
-
return join(cwd,
|
|
330
|
+
return join(cwd, CONFIG_DIR_NAME, "settings.json");
|
|
334
331
|
}
|
|
335
332
|
|
|
336
333
|
function getGlobalCompactionPolicyPath(): string {
|
|
337
|
-
|
|
338
|
-
return join(homeDir, ".pi", "agent", "compaction-policy.json");
|
|
334
|
+
return join(getAgentDir(), "compaction-policy.json");
|
|
339
335
|
}
|
|
340
336
|
|
|
341
337
|
function getCustomCompactionExtensionPath(): string {
|
|
342
|
-
|
|
343
|
-
return join(homeDir, ".pi", "agent", "extensions", "pi-custom-compaction");
|
|
338
|
+
return join(getAgentDir(), "extensions", "pi-custom-compaction");
|
|
344
339
|
}
|
|
345
340
|
|
|
346
341
|
function mergeSettings(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown> {
|
|
@@ -413,7 +408,7 @@ function readCompactionPolicyEnabled(configPath: string): boolean | undefined {
|
|
|
413
408
|
function detectCustomCompactionEnabled(cwd: string): boolean {
|
|
414
409
|
if (!existsSync(getCustomCompactionExtensionPath())) return false;
|
|
415
410
|
|
|
416
|
-
const projectSetting = readCompactionPolicyEnabled(join(cwd,
|
|
411
|
+
const projectSetting = readCompactionPolicyEnabled(join(cwd, CONFIG_DIR_NAME, "compaction-policy.json"));
|
|
417
412
|
if (projectSetting !== undefined) return projectSetting;
|
|
418
413
|
|
|
419
414
|
return readCompactionPolicyEnabled(getGlobalCompactionPolicyPath()) ?? false;
|
|
@@ -424,13 +419,11 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
424
419
|
}
|
|
425
420
|
|
|
426
421
|
function getStashHistoryPath(): string {
|
|
427
|
-
|
|
428
|
-
return join(homeDir, ".pi", "agent", "powerline-footer", "stash-history.json");
|
|
422
|
+
return join(getAgentDir(), "powerline-footer", "stash-history.json");
|
|
429
423
|
}
|
|
430
424
|
|
|
431
425
|
function getSessionsPath(): string {
|
|
432
|
-
|
|
433
|
-
return join(homeDir, ".pi", "agent", "sessions");
|
|
426
|
+
return join(getAgentDir(), "sessions");
|
|
434
427
|
}
|
|
435
428
|
|
|
436
429
|
function getProjectSessionsPath(cwd: string): string {
|
|
@@ -885,7 +878,7 @@ function computeResponsiveLayout(
|
|
|
885
878
|
): { topContent: string; secondaryContent: string } {
|
|
886
879
|
const separatorDef = getSeparator(presetDef.separator);
|
|
887
880
|
const sepWidth = visibleWidth(separatorDef.left); // separator, no surrounding spaces
|
|
888
|
-
|
|
881
|
+
|
|
889
882
|
const mergedSegments = mergeSegmentsWithCustomItems(presetDef, config.customItems);
|
|
890
883
|
const renderIds = (ids: StatusLineSegmentId[]): string[] => {
|
|
891
884
|
const parts: string[] = [];
|
|
@@ -956,7 +949,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
956
949
|
let bashTranscript = new BashTranscriptStore(bashModeSettings);
|
|
957
950
|
let bashCompletionEngine = new BashCompletionEngine();
|
|
958
951
|
let shellSession: ManagedShellSession | null = null;
|
|
959
|
-
|
|
952
|
+
|
|
960
953
|
// Cache for the top and secondary powerline widgets.
|
|
961
954
|
let lastLayoutWidth = 0;
|
|
962
955
|
let lastLayoutResult: { topContent: string; secondaryContent: string } | null = null;
|
|
@@ -1208,10 +1201,10 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
1208
1201
|
if (ctx.hasUI) {
|
|
1209
1202
|
ctx.ui.setStatus("stash", undefined);
|
|
1210
1203
|
}
|
|
1211
|
-
|
|
1204
|
+
|
|
1212
1205
|
// Initialize vibe manager (needs modelRegistry from ctx)
|
|
1213
1206
|
initVibeManager(ctx);
|
|
1214
|
-
|
|
1207
|
+
|
|
1215
1208
|
if (enabled && ctx.hasUI) {
|
|
1216
1209
|
setupCustomEditor(ctx);
|
|
1217
1210
|
if (event.reason === "startup") {
|
|
@@ -1369,18 +1362,18 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
1369
1362
|
onVibeToolCall(event.toolName, event.input, ctx.ui.setWorkingMessage, agentContext);
|
|
1370
1363
|
}
|
|
1371
1364
|
});
|
|
1372
|
-
|
|
1365
|
+
|
|
1373
1366
|
// Helper to extract recent agent response text (skipping thinking blocks)
|
|
1374
1367
|
function getRecentAgentContext(ctx: any): string | undefined {
|
|
1375
1368
|
const sessionEvents = ctx.sessionManager?.getBranch?.() ?? [];
|
|
1376
|
-
|
|
1369
|
+
|
|
1377
1370
|
// Find the most recent assistant message
|
|
1378
1371
|
for (let i = sessionEvents.length - 1; i >= 0; i--) {
|
|
1379
1372
|
const e = sessionEvents[i];
|
|
1380
1373
|
if (e.type === "message" && e.message?.role === "assistant") {
|
|
1381
1374
|
const content = e.message.content;
|
|
1382
1375
|
if (!Array.isArray(content)) continue;
|
|
1383
|
-
|
|
1376
|
+
|
|
1384
1377
|
// Extract text content, skip thinking blocks
|
|
1385
1378
|
for (const block of content) {
|
|
1386
1379
|
if (block.type === "text" && block.text) {
|
|
@@ -1690,7 +1683,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
1690
1683
|
handler: async (args, ctx) => {
|
|
1691
1684
|
// Update context reference (command ctx may have more methods)
|
|
1692
1685
|
currentCtx = ctx;
|
|
1693
|
-
|
|
1686
|
+
|
|
1694
1687
|
if (!args?.trim()) {
|
|
1695
1688
|
// Toggle
|
|
1696
1689
|
enabled = !enabled;
|
|
@@ -1910,7 +1903,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
1910
1903
|
handler: async (args, ctx) => {
|
|
1911
1904
|
const parts = args?.trim().split(/\s+/) || [];
|
|
1912
1905
|
const subcommand = parts[0]?.toLowerCase();
|
|
1913
|
-
|
|
1906
|
+
|
|
1914
1907
|
// No args: show current status
|
|
1915
1908
|
if (!args || !args.trim()) {
|
|
1916
1909
|
const theme = getVibeTheme();
|
|
@@ -1924,7 +1917,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
1924
1917
|
ctx.ui.notify(status, "info");
|
|
1925
1918
|
return;
|
|
1926
1919
|
}
|
|
1927
|
-
|
|
1920
|
+
|
|
1928
1921
|
// /vibe model [spec] - show or set model
|
|
1929
1922
|
if (subcommand === "model") {
|
|
1930
1923
|
const modelSpec = parts.slice(1).join(" ");
|
|
@@ -1945,7 +1938,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
1945
1938
|
}
|
|
1946
1939
|
return;
|
|
1947
1940
|
}
|
|
1948
|
-
|
|
1941
|
+
|
|
1949
1942
|
// /vibe mode [generate|file] - show or set mode
|
|
1950
1943
|
if (subcommand === "mode") {
|
|
1951
1944
|
const newMode = parts[1]?.toLowerCase();
|
|
@@ -1971,7 +1964,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
1971
1964
|
}
|
|
1972
1965
|
return;
|
|
1973
1966
|
}
|
|
1974
|
-
|
|
1967
|
+
|
|
1975
1968
|
// /vibe generate <theme> [count] - generate vibes and save to file
|
|
1976
1969
|
if (subcommand === "generate") {
|
|
1977
1970
|
const theme = parts[1];
|
|
@@ -1988,7 +1981,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
1988
1981
|
ctx.ui.notify(`Generating ${count} vibes for "${theme}"...`, "info");
|
|
1989
1982
|
|
|
1990
1983
|
const result = await generateVibesBatch(theme, count);
|
|
1991
|
-
|
|
1984
|
+
|
|
1992
1985
|
if (result.success) {
|
|
1993
1986
|
ctx.ui.notify(`Generated ${result.count} vibes for "${theme}" → ${result.filePath}`, "info");
|
|
1994
1987
|
} else {
|
|
@@ -1996,7 +1989,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
1996
1989
|
}
|
|
1997
1990
|
return;
|
|
1998
1991
|
}
|
|
1999
|
-
|
|
1992
|
+
|
|
2000
1993
|
// /vibe off - disable
|
|
2001
1994
|
if (subcommand === "off") {
|
|
2002
1995
|
const persisted = setVibeTheme(null);
|
|
@@ -2007,7 +2000,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
2007
2000
|
}
|
|
2008
2001
|
return;
|
|
2009
2002
|
}
|
|
2010
|
-
|
|
2003
|
+
|
|
2011
2004
|
// /vibe <theme> - set theme (preserve original casing)
|
|
2012
2005
|
const theme = args.trim();
|
|
2013
2006
|
const persisted = setVibeTheme(theme);
|
|
@@ -2046,7 +2039,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
2046
2039
|
let input = 0, output = 0, cacheRead = 0, cacheWrite = 0, cost = 0;
|
|
2047
2040
|
let lastAssistant: AssistantMessage | undefined;
|
|
2048
2041
|
let thinkingLevelFromSession: string | null = null;
|
|
2049
|
-
|
|
2042
|
+
|
|
2050
2043
|
const sessionEvents = ctx.sessionManager?.getBranch?.() ?? [];
|
|
2051
2044
|
for (const e of sessionEvents) {
|
|
2052
2045
|
if (!isRecord(e)) {
|
|
@@ -2145,17 +2138,17 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
2145
2138
|
return lastLayoutResult;
|
|
2146
2139
|
}
|
|
2147
2140
|
}
|
|
2148
|
-
|
|
2141
|
+
|
|
2149
2142
|
const presetDef = getPreset(config.preset);
|
|
2150
2143
|
const segmentCtx = buildSegmentContext(currentCtx, theme);
|
|
2151
|
-
|
|
2144
|
+
|
|
2152
2145
|
lastLayoutWidth = width;
|
|
2153
2146
|
lastLayoutResult = computeResponsiveLayout(segmentCtx, presetDef, width);
|
|
2154
2147
|
lastLayoutSessionName = currentSessionName;
|
|
2155
2148
|
lastLayoutTimestamp = now;
|
|
2156
2149
|
layoutDirty = false;
|
|
2157
2150
|
forceNextLayoutRecompute = false;
|
|
2158
|
-
|
|
2151
|
+
|
|
2159
2152
|
return lastLayoutResult;
|
|
2160
2153
|
}
|
|
2161
2154
|
|
|
@@ -2717,10 +2710,10 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
2717
2710
|
const providerName = ctx.model?.provider || "Unknown";
|
|
2718
2711
|
const loadedCounts = discoverLoadedCounts();
|
|
2719
2712
|
const recentSessions = getRecentSessions(3);
|
|
2720
|
-
|
|
2713
|
+
|
|
2721
2714
|
const header = new WelcomeHeader(modelName, providerName, recentSessions, loadedCounts);
|
|
2722
2715
|
welcomeHeaderActive = true;
|
|
2723
|
-
|
|
2716
|
+
|
|
2724
2717
|
ctx.ui.setHeader(() => {
|
|
2725
2718
|
return {
|
|
2726
2719
|
render(width: number): string[] {
|
|
@@ -2738,7 +2731,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
2738
2731
|
const providerName = ctx.model?.provider || "Unknown";
|
|
2739
2732
|
const loadedCounts = discoverLoadedCounts();
|
|
2740
2733
|
const recentSessions = getRecentSessions(3);
|
|
2741
|
-
|
|
2734
|
+
|
|
2742
2735
|
const overlaySessionGeneration = sessionGeneration;
|
|
2743
2736
|
|
|
2744
2737
|
// Small delay to let pi-mono finish initialization
|
|
@@ -2747,7 +2740,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
2747
2740
|
welcomeOverlayShouldDismiss = false;
|
|
2748
2741
|
return;
|
|
2749
2742
|
}
|
|
2750
|
-
|
|
2743
|
+
|
|
2751
2744
|
const sessionEvents = ctx.sessionManager?.getBranch?.() ?? [];
|
|
2752
2745
|
const hasActivity = sessionEvents.some((entry: unknown) => {
|
|
2753
2746
|
if (!isRecord(entry)) return false;
|
|
@@ -2757,7 +2750,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
2757
2750
|
if (hasActivity) {
|
|
2758
2751
|
return;
|
|
2759
2752
|
}
|
|
2760
|
-
|
|
2753
|
+
|
|
2761
2754
|
ctx.ui.custom(
|
|
2762
2755
|
(tui: any, _theme: any, _keybindings: any, done: (result: void) => void) => {
|
|
2763
2756
|
const welcome = new WelcomeComponent(
|
|
@@ -2766,11 +2759,11 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
2766
2759
|
recentSessions,
|
|
2767
2760
|
loadedCounts,
|
|
2768
2761
|
);
|
|
2769
|
-
|
|
2762
|
+
|
|
2770
2763
|
let countdown = 30;
|
|
2771
2764
|
let dismissed = false;
|
|
2772
2765
|
let interval: ReturnType<typeof setInterval> | null = null;
|
|
2773
|
-
|
|
2766
|
+
|
|
2774
2767
|
const dismiss = () => {
|
|
2775
2768
|
if (dismissed) return;
|
|
2776
2769
|
dismissed = true;
|
|
@@ -2778,7 +2771,7 @@ export default function powerlineFooter(pi: ExtensionAPI) {
|
|
|
2778
2771
|
dismissWelcomeOverlay = null;
|
|
2779
2772
|
done();
|
|
2780
2773
|
};
|
|
2781
|
-
|
|
2774
|
+
|
|
2782
2775
|
interval = setInterval(() => {
|
|
2783
2776
|
if (dismissed) return;
|
|
2784
2777
|
countdown--;
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@earendil-works/pi-ai": "^0.75.0",
|
|
33
|
-
"@
|
|
33
|
+
"@selesai/code": "*",
|
|
34
34
|
"@earendil-works/pi-tui": "^0.75.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@earendil-works/pi-ai": "^0.75.0",
|
|
38
|
-
"@
|
|
38
|
+
"@selesai/code": "^0.1.0",
|
|
39
39
|
"@earendil-works/pi-tui": "^0.75.0"
|
|
40
40
|
},
|
|
41
41
|
"pi": {
|
|
@@ -29,11 +29,11 @@ function ensureEditorModuleLinks(): { cleanup: () => void } {
|
|
|
29
29
|
const links = [
|
|
30
30
|
{
|
|
31
31
|
link: join(nodeModulesDir, "pi-coding-agent"),
|
|
32
|
-
target: "/opt/homebrew/lib/node_modules/@
|
|
32
|
+
target: "/opt/homebrew/lib/node_modules/@selesai/code",
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
link: join(nodeModulesDir, "pi-tui"),
|
|
36
|
-
target: "/opt/homebrew/lib/node_modules/@
|
|
36
|
+
target: "/opt/homebrew/lib/node_modules/@selesai/code/node_modules/@earendil-works/pi-tui",
|
|
37
37
|
},
|
|
38
38
|
];
|
|
39
39
|
|
|
@@ -559,7 +559,7 @@ test("bash editor does not submit pasted multiline input while bracketed paste i
|
|
|
559
559
|
|
|
560
560
|
try {
|
|
561
561
|
const { BashModeEditor } = await import("../bash-mode/editor.ts");
|
|
562
|
-
const { CustomEditor } = await import(new URL("../node_modules/@
|
|
562
|
+
const { CustomEditor } = await import(new URL("../node_modules/@selesai/code/dist/modes/interactive/components/custom-editor.js", import.meta.url).href);
|
|
563
563
|
|
|
564
564
|
let delegated = 0;
|
|
565
565
|
let submitted = 0;
|
|
@@ -607,7 +607,7 @@ test("bash editor refreshes shell ghost state after a bracketed paste completes"
|
|
|
607
607
|
|
|
608
608
|
try {
|
|
609
609
|
const { BashModeEditor } = await import("../bash-mode/editor.ts");
|
|
610
|
-
const { CustomEditor } = await import(new URL("../node_modules/@
|
|
610
|
+
const { CustomEditor } = await import(new URL("../node_modules/@selesai/code/dist/modes/interactive/components/custom-editor.js", import.meta.url).href);
|
|
611
611
|
|
|
612
612
|
let delegated = 0;
|
|
613
613
|
let scheduled = 0;
|
|
@@ -666,7 +666,7 @@ test("bash editor inserts Finder file drops as path strings", async () => {
|
|
|
666
666
|
|
|
667
667
|
try {
|
|
668
668
|
const { BashModeEditor } = await import("../bash-mode/editor.ts");
|
|
669
|
-
const { KeybindingsManager } = await import(new URL("../node_modules/@
|
|
669
|
+
const { KeybindingsManager } = await import(new URL("../node_modules/@selesai/code/dist/core/keybindings.js", import.meta.url).href);
|
|
670
670
|
const keybindings = KeybindingsManager.create();
|
|
671
671
|
let scheduled = 0;
|
|
672
672
|
const editor = new BashModeEditor(
|
|
@@ -988,7 +988,7 @@ test("bash editor runs copied Pi app action handlers for alt-enter", async () =>
|
|
|
988
988
|
|
|
989
989
|
try {
|
|
990
990
|
const { BashModeEditor } = await import("../bash-mode/editor.ts");
|
|
991
|
-
const { KeybindingsManager } = await import(new URL("../node_modules/@
|
|
991
|
+
const { KeybindingsManager } = await import(new URL("../node_modules/@selesai/code/dist/core/keybindings.js", import.meta.url).href);
|
|
992
992
|
const { setKittyProtocolActive } = await import(new URL("../node_modules/@earendil-works/pi-tui/dist/keys.js", import.meta.url).href);
|
|
993
993
|
const keybindings = KeybindingsManager.create();
|
|
994
994
|
const editor = new BashModeEditor(
|
|
@@ -1034,7 +1034,7 @@ test("bash editor command-z undoes deleted text for supported encodings only", a
|
|
|
1034
1034
|
|
|
1035
1035
|
try {
|
|
1036
1036
|
const { BashModeEditor } = await import("../bash-mode/editor.ts");
|
|
1037
|
-
const { KeybindingsManager } = await import(new URL("../node_modules/@
|
|
1037
|
+
const { KeybindingsManager } = await import(new URL("../node_modules/@selesai/code/dist/core/keybindings.js", import.meta.url).href);
|
|
1038
1038
|
const keybindings = KeybindingsManager.create();
|
|
1039
1039
|
const createEditor = (options: {
|
|
1040
1040
|
keybindings?: typeof keybindings;
|
|
@@ -1124,7 +1124,7 @@ test("bash editor command-z resets shell history and updates ghost state", async
|
|
|
1124
1124
|
|
|
1125
1125
|
try {
|
|
1126
1126
|
const { BashModeEditor } = await import("../bash-mode/editor.ts");
|
|
1127
|
-
const { KeybindingsManager } = await import(new URL("../node_modules/@
|
|
1127
|
+
const { KeybindingsManager } = await import(new URL("../node_modules/@selesai/code/dist/core/keybindings.js", import.meta.url).href);
|
|
1128
1128
|
const keybindings = KeybindingsManager.create();
|
|
1129
1129
|
const createEditor = (options: {
|
|
1130
1130
|
isBashModeActive?: () => boolean;
|
|
@@ -1183,7 +1183,7 @@ test("bash editor command arrows jump to editor boundaries", async () => {
|
|
|
1183
1183
|
|
|
1184
1184
|
try {
|
|
1185
1185
|
const { BashModeEditor } = await import("../bash-mode/editor.ts");
|
|
1186
|
-
const { KeybindingsManager } = await import(new URL("../node_modules/@
|
|
1186
|
+
const { KeybindingsManager } = await import(new URL("../node_modules/@selesai/code/dist/core/keybindings.js", import.meta.url).href);
|
|
1187
1187
|
const keybindings = KeybindingsManager.create();
|
|
1188
1188
|
let renderRequests = 0;
|
|
1189
1189
|
const editor = new BashModeEditor(
|
|
@@ -1381,7 +1381,7 @@ test("one-off bang submit does not accept ghost text before submitting", async (
|
|
|
1381
1381
|
|
|
1382
1382
|
try {
|
|
1383
1383
|
const { BashModeEditor } = await import("../bash-mode/editor.ts");
|
|
1384
|
-
const { CustomEditor } = await import(new URL("../node_modules/@
|
|
1384
|
+
const { CustomEditor } = await import(new URL("../node_modules/@selesai/code/dist/modes/interactive/components/custom-editor.js", import.meta.url).href);
|
|
1385
1385
|
|
|
1386
1386
|
let delegated = 0;
|
|
1387
1387
|
const superHandleInput = CustomEditor.prototype.handleInput;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import test from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
|
-
import { KEYBINDINGS } from "../node_modules/@
|
|
4
|
+
import { KEYBINDINGS } from "../node_modules/@selesai/code/dist/core/keybindings.js";
|
|
5
5
|
import {
|
|
6
6
|
isSupportedSuperShortcut,
|
|
7
7
|
matchesConfiguredShortcut,
|
|
@@ -12,11 +12,11 @@ function ensurePiModuleLinks(): { cleanup: () => void } {
|
|
|
12
12
|
const links = [
|
|
13
13
|
{
|
|
14
14
|
link: join(nodeModulesDir, "pi-coding-agent"),
|
|
15
|
-
target: "/opt/homebrew/lib/node_modules/@
|
|
15
|
+
target: "/opt/homebrew/lib/node_modules/@selesai/code",
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
link: join(nodeModulesDir, "pi-ai"),
|
|
19
|
-
target: "/opt/homebrew/lib/node_modules/@
|
|
19
|
+
target: "/opt/homebrew/lib/node_modules/@selesai/code/node_modules/@earendil-works/pi-ai",
|
|
20
20
|
},
|
|
21
21
|
];
|
|
22
22
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Theme system for powerline-footer
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Colors are resolved in order:
|
|
5
5
|
* 1. User overrides from theme.json (if exists)
|
|
6
6
|
* 2. Preset colors
|
|
7
7
|
* 3. Default colors
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { Theme, ThemeColor } from "@
|
|
10
|
+
import type { Theme, ThemeColor } from "@selesai/code";
|
|
11
11
|
import { existsSync, readFileSync } from "node:fs";
|
|
12
12
|
import { join, dirname } from "node:path";
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
@@ -40,7 +40,7 @@ const DEFAULT_COLORS: Required<ColorScheme> = {
|
|
|
40
40
|
|
|
41
41
|
// Rainbow colors for high thinking levels
|
|
42
42
|
const RAINBOW_COLORS = [
|
|
43
|
-
"#b281d6", "#d787af", "#febc38", "#e4c00f",
|
|
43
|
+
"#b281d6", "#d787af", "#febc38", "#e4c00f",
|
|
44
44
|
"#89d281", "#00afaf", "#178fb9", "#b281d6",
|
|
45
45
|
];
|
|
46
46
|
|
|
@@ -137,10 +137,10 @@ export function resolveColor(
|
|
|
137
137
|
presetColors?: ColorScheme
|
|
138
138
|
): ColorValue {
|
|
139
139
|
const userTheme = loadUserTheme();
|
|
140
|
-
|
|
140
|
+
|
|
141
141
|
// Priority: user overrides > preset colors > defaults
|
|
142
|
-
return userTheme[semantic]
|
|
143
|
-
?? presetColors?.[semantic]
|
|
142
|
+
return userTheme[semantic]
|
|
143
|
+
?? presetColors?.[semantic]
|
|
144
144
|
?? DEFAULT_COLORS[semantic];
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* into a combined "main + subagents" TPS at agent_end.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import type { ExtensionAPI } from "@
|
|
15
|
+
import type { ExtensionAPI } from "@selesai/code";
|
|
16
16
|
|
|
17
17
|
export function setupTpsTracker(pi: ExtensionAPI): void {
|
|
18
18
|
/** Timestamp when the current assistant message event started. Used as a fallback. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Theme, ThemeColor } from "@
|
|
1
|
+
import type { Theme, ThemeColor } from "@selesai/code";
|
|
2
2
|
|
|
3
3
|
// Theme color - either a pi theme color name or a custom hex color
|
|
4
4
|
export type ColorValue = ThemeColor | `#${string}`;
|
|
@@ -80,7 +80,7 @@ export type StatusLinePreset =
|
|
|
80
80
|
// Per-segment options
|
|
81
81
|
export interface StatusLineSegmentOptions {
|
|
82
82
|
model?: { showThinkingLevel?: boolean };
|
|
83
|
-
path?: {
|
|
83
|
+
path?: {
|
|
84
84
|
mode?: "basename" | "abbreviated" | "full";
|
|
85
85
|
maxLength?: number;
|
|
86
86
|
};
|
|
@@ -148,7 +148,7 @@ export interface SegmentContext {
|
|
|
148
148
|
sessionId: string | undefined;
|
|
149
149
|
sessionName: string | undefined;
|
|
150
150
|
cwd?: string;
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
// Computed
|
|
153
153
|
usageStats: UsageStats;
|
|
154
154
|
contextPercent: number;
|
|
@@ -161,18 +161,18 @@ export interface SegmentContext {
|
|
|
161
161
|
shellRunning: boolean;
|
|
162
162
|
shellName: string | null;
|
|
163
163
|
shellCwd: string | null;
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
// Git
|
|
166
166
|
git: GitStatus;
|
|
167
|
-
|
|
167
|
+
|
|
168
168
|
// Extension statuses
|
|
169
169
|
extensionStatuses: ReadonlyMap<string, string>;
|
|
170
170
|
hiddenExtensionStatusKeys: ReadonlySet<string>;
|
|
171
171
|
customItemsById: ReadonlyMap<string, CustomStatusItem>;
|
|
172
|
-
|
|
172
|
+
|
|
173
173
|
// Options
|
|
174
174
|
options: StatusLineSegmentOptions;
|
|
175
|
-
|
|
175
|
+
|
|
176
176
|
// Theming
|
|
177
177
|
theme: ThemeLike;
|
|
178
178
|
colors: ColorScheme;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readdirSync, existsSync, statSync, readFileSync } from "node:fs";
|
|
2
2
|
import { join, basename } from "node:path";
|
|
3
3
|
import { homedir as osHomedir } from "node:os";
|
|
4
|
+
import { CONFIG_DIR_NAME, getAgentDir, getSettingsPath } from "@selesai/code";
|
|
4
5
|
import type { Component } from "@earendil-works/pi-tui";
|
|
5
6
|
import { truncateToWidth as tuiTruncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
6
7
|
import { ansi, fgOnly, getFgAnsiCode } from "./colors.ts";
|
|
@@ -330,11 +331,16 @@ function logDiscoveryError(scope: string, error: unknown): void {
|
|
|
330
331
|
console.debug(`[powerline-welcome] ${scope}:`, error);
|
|
331
332
|
}
|
|
332
333
|
|
|
334
|
+
// ponytail: only .claude paths still need raw home; everything else routes via getAgentDir.
|
|
335
|
+
function homedirSafe(): string {
|
|
336
|
+
return process.env.HOME || process.env.USERPROFILE || osHomedir();
|
|
337
|
+
}
|
|
338
|
+
|
|
333
339
|
/**
|
|
334
340
|
* Discover loaded counts by scanning filesystem.
|
|
335
341
|
*/
|
|
336
342
|
export function discoverLoadedCounts(): LoadedCounts {
|
|
337
|
-
const homeDir =
|
|
343
|
+
const homeDir = getAgentDir();
|
|
338
344
|
const cwd = process.cwd();
|
|
339
345
|
|
|
340
346
|
let contextFiles = 0;
|
|
@@ -343,10 +349,10 @@ export function discoverLoadedCounts(): LoadedCounts {
|
|
|
343
349
|
let promptTemplates = 0;
|
|
344
350
|
|
|
345
351
|
const agentsMdPaths = [
|
|
346
|
-
join(homeDir, "
|
|
347
|
-
join(
|
|
352
|
+
join(homeDir, "AGENTS.md"),
|
|
353
|
+
join(homedirSafe(), ".claude", "AGENTS.md"),
|
|
348
354
|
join(cwd, "AGENTS.md"),
|
|
349
|
-
join(cwd,
|
|
355
|
+
join(cwd, CONFIG_DIR_NAME, "AGENTS.md"),
|
|
350
356
|
join(cwd, ".claude", "AGENTS.md"),
|
|
351
357
|
];
|
|
352
358
|
|
|
@@ -355,16 +361,16 @@ export function discoverLoadedCounts(): LoadedCounts {
|
|
|
355
361
|
}
|
|
356
362
|
|
|
357
363
|
const extensionDirs = [
|
|
358
|
-
join(homeDir, "
|
|
364
|
+
join(homeDir, "extensions"),
|
|
359
365
|
join(cwd, "extensions"),
|
|
360
|
-
join(cwd,
|
|
366
|
+
join(cwd, CONFIG_DIR_NAME, "extensions"),
|
|
361
367
|
];
|
|
362
368
|
|
|
363
369
|
const countedExtensions = new Set<string>();
|
|
364
370
|
|
|
365
371
|
const settingsPaths = [
|
|
366
|
-
|
|
367
|
-
join(cwd,
|
|
372
|
+
getSettingsPath(),
|
|
373
|
+
join(cwd, CONFIG_DIR_NAME, "settings.json"),
|
|
368
374
|
];
|
|
369
375
|
|
|
370
376
|
for (const settingsPath of settingsPaths) {
|
|
@@ -460,8 +466,8 @@ export function discoverLoadedCounts(): LoadedCounts {
|
|
|
460
466
|
}
|
|
461
467
|
|
|
462
468
|
const skillDirs = [
|
|
463
|
-
join(homeDir, "
|
|
464
|
-
join(cwd,
|
|
469
|
+
join(homeDir, "skills"),
|
|
470
|
+
join(cwd, CONFIG_DIR_NAME, "skills"),
|
|
465
471
|
join(cwd, "skills"),
|
|
466
472
|
];
|
|
467
473
|
|
|
@@ -493,9 +499,9 @@ export function discoverLoadedCounts(): LoadedCounts {
|
|
|
493
499
|
}
|
|
494
500
|
|
|
495
501
|
const templateDirs = [
|
|
496
|
-
join(homeDir, "
|
|
497
|
-
join(
|
|
498
|
-
join(cwd,
|
|
502
|
+
join(homeDir, "commands"),
|
|
503
|
+
join(homedirSafe(), ".claude", "commands"),
|
|
504
|
+
join(cwd, CONFIG_DIR_NAME, "commands"),
|
|
499
505
|
join(cwd, ".claude", "commands"),
|
|
500
506
|
];
|
|
501
507
|
|
|
@@ -538,11 +544,12 @@ export function discoverLoadedCounts(): LoadedCounts {
|
|
|
538
544
|
* Get recent sessions from the sessions directory.
|
|
539
545
|
*/
|
|
540
546
|
export function getRecentSessions(maxCount: number = 3): RecentSession[] {
|
|
541
|
-
const homeDir =
|
|
547
|
+
const homeDir = getAgentDir();
|
|
548
|
+
const home = homedirSafe();
|
|
542
549
|
|
|
543
550
|
const sessionsDirs = [
|
|
544
|
-
join(homeDir, "
|
|
545
|
-
join(
|
|
551
|
+
join(homeDir, "sessions"),
|
|
552
|
+
join(home, CONFIG_DIR_NAME, "sessions"),
|
|
546
553
|
];
|
|
547
554
|
|
|
548
555
|
const sessions: { name: string; mtime: number }[] = [];
|