@phi-code-admin/phi-code 0.84.2 → 0.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +95 -126
  3. package/agents/code.md +1 -0
  4. package/agents/explore.md +11 -5
  5. package/agents/plan.md +18 -3
  6. package/agents/review.md +18 -7
  7. package/agents/test.md +1 -0
  8. package/config/routing.example.json +129 -0
  9. package/config/routing.schema.json +58 -0
  10. package/dist/cli/args.d.ts.map +1 -1
  11. package/dist/cli/args.js +1 -1
  12. package/dist/cli/args.js.map +1 -1
  13. package/dist/config.d.ts.map +1 -1
  14. package/dist/config.js +1 -1
  15. package/dist/config.js.map +1 -1
  16. package/dist/core/sdk.d.ts.map +1 -1
  17. package/dist/core/sdk.js +3 -3
  18. package/dist/core/sdk.js.map +1 -1
  19. package/dist/core/system-prompt.d.ts.map +1 -1
  20. package/dist/core/system-prompt.js +6 -6
  21. package/dist/core/system-prompt.js.map +1 -1
  22. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  23. package/dist/modes/interactive/components/config-selector.js +1 -1
  24. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  25. package/dist/modes/interactive/interactive-mode.d.ts +2 -2
  26. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  27. package/dist/modes/interactive/interactive-mode.js +32 -30
  28. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  29. package/dist/package-manager-cli.d.ts.map +1 -1
  30. package/dist/package-manager-cli.js +9 -8
  31. package/dist/package-manager-cli.js.map +1 -1
  32. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  33. package/dist/utils/pi-user-agent.js +4 -1
  34. package/dist/utils/pi-user-agent.js.map +1 -1
  35. package/dist/utils/version-check.d.ts +5 -5
  36. package/dist/utils/version-check.d.ts.map +1 -1
  37. package/dist/utils/version-check.js +13 -8
  38. package/dist/utils/version-check.js.map +1 -1
  39. package/docs/compaction.md +11 -11
  40. package/docs/custom-provider.md +4 -4
  41. package/docs/development.md +2 -2
  42. package/docs/extensions.md +47 -47
  43. package/docs/fork-policy.md +63 -0
  44. package/docs/index.md +7 -7
  45. package/docs/json.md +3 -3
  46. package/docs/keybindings.md +5 -5
  47. package/docs/models.md +6 -6
  48. package/docs/packages.md +37 -37
  49. package/docs/prompt-templates.md +4 -4
  50. package/docs/providers.md +9 -9
  51. package/docs/quickstart.md +25 -25
  52. package/docs/rpc.md +3 -3
  53. package/docs/sdk.md +34 -34
  54. package/docs/session-format.md +4 -4
  55. package/docs/sessions.md +11 -11
  56. package/docs/settings.md +11 -11
  57. package/docs/shell-aliases.md +2 -2
  58. package/docs/skills.md +9 -9
  59. package/docs/terminal-setup.md +7 -7
  60. package/docs/termux.md +6 -6
  61. package/docs/themes.md +9 -9
  62. package/docs/tmux.md +3 -3
  63. package/docs/tui.md +8 -8
  64. package/docs/usage.md +40 -40
  65. package/docs/windows.md +2 -2
  66. package/examples/sdk/12-full-control.ts +1 -1
  67. package/extensions/phi/agents.ts +5 -113
  68. package/extensions/phi/models.ts +170 -49
  69. package/extensions/phi/orchestrator.ts +44 -37
  70. package/extensions/phi/providers/agent-def.ts +128 -0
  71. package/extensions/phi/providers/live-models.ts +31 -1
  72. package/extensions/phi/providers/opencode-go.ts +7 -3
  73. package/extensions/phi/setup.ts +9 -0
  74. package/extensions/phi/skill-loader.ts +46 -25
  75. package/package.json +2 -1
@@ -8,7 +8,7 @@ import * as os from "node:os";
8
8
  import * as path from "node:path";
9
9
  import { spawn, spawnSync } from "child_process";
10
10
  import { getProviders, } from "phi-code-ai";
11
- import { CombinedAutocompleteProvider, Container, fuzzyFilter, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth, } from "phi-code-tui";
11
+ import { CombinedAutocompleteProvider, Container, fuzzyFilter, getCapabilities, hyperlink, Loader, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth, } from "phi-code-tui";
12
12
  import { APP_NAME, APP_TITLE, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
13
13
  import { parseSkillBlock } from "../../core/agent-session.js";
14
14
  import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
@@ -21,16 +21,14 @@ import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "../../core/provider-display-nam
21
21
  import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
22
22
  import { SessionManager } from "../../core/session-manager.js";
23
23
  import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
24
- import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
25
24
  import { getChangelogPath, getNewEntries, parseChangelog } from "../../utils/changelog.js";
26
25
  import { copyToClipboard } from "../../utils/clipboard.js";
27
26
  import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
28
27
  import { parseGitUrl } from "../../utils/git.js";
29
28
  import { getCwdRelativePath } from "../../utils/paths.js";
30
- import { getPiUserAgent } from "../../utils/pi-user-agent.js";
31
29
  import { killTrackedDetachedChildren } from "../../utils/shell.js";
32
30
  import { ensureTool } from "../../utils/tools-manager.js";
33
- import { checkForNewPiVersion } from "../../utils/version-check.js";
31
+ import { checkForNewVersion } from "../../utils/version-check.js";
34
32
  import { ArminComponent } from "./components/armin.js";
35
33
  import { AssistantMessageComponent } from "./components/assistant-message.js";
36
34
  import { BashExecutionComponent } from "./components/bash-execution.js";
@@ -478,7 +476,7 @@ export class InteractiveMode {
478
476
  hint("app.tools.expand", "more"),
479
477
  ].join(theme.fg("muted", " · "));
480
478
  const compactOnboarding = theme.fg("dim", `Press ${keyText("app.tools.expand")} to show full startup help and loaded resources.`);
481
- const onboarding = theme.fg("dim", `Pi can explain its own features and look up its docs. Ask it how to use or extend Pi.`);
479
+ const onboarding = theme.fg("dim", `${APP_TITLE} can explain its own features and look up its docs. Ask it how to use or extend ${APP_TITLE}.`);
482
480
  this.builtInHeader = new ExpandableText(() => `${logo}\n${compactInstructions}\n${compactOnboarding}\n\n${onboarding}`, () => `${logo}\n${expandedInstructions}\n\n${onboarding}`, this.getStartupExpansionState(), 1, 0);
483
481
  }
484
482
  else {
@@ -540,7 +538,7 @@ export class InteractiveMode {
540
538
  async run() {
541
539
  await this.init();
542
540
  // Start version check asynchronously
543
- checkForNewPiVersion(this.version).then((newVersion) => {
541
+ checkForNewVersion(this.version).then((newVersion) => {
544
542
  if (newVersion) {
545
543
  this.showNewVersionNotification(newVersion);
546
544
  }
@@ -657,7 +655,7 @@ export class InteractiveMode {
657
655
  return "tmux extended-keys is off. Modified Enter keys may not work. Add `set -g extended-keys on` to ~/.tmux.conf and restart tmux.";
658
656
  }
659
657
  if (extendedKeysFormat === "xterm") {
660
- return "tmux extended-keys-format is xterm. Pi works best with csi-u. Add `set -g extended-keys-format csi-u` to ~/.tmux.conf and restart tmux.";
658
+ return `tmux extended-keys-format is xterm. ${APP_NAME} works best with csi-u. Add \`set -g extended-keys-format csi-u\` to ~/.tmux.conf and restart tmux.`;
661
659
  }
662
660
  return undefined;
663
661
  }
@@ -687,21 +685,11 @@ export class InteractiveMode {
687
685
  }
688
686
  return undefined;
689
687
  }
690
- reportInstallTelemetry(version) {
691
- if (process.env.PI_OFFLINE) {
692
- return;
693
- }
694
- if (!isInstallTelemetryEnabled(this.settingsManager)) {
695
- return;
696
- }
697
- void fetch(`https://pi.dev/api/report-install?version=${encodeURIComponent(version)}`, {
698
- headers: {
699
- "User-Agent": getPiUserAgent(version),
700
- },
701
- signal: AbortSignal.timeout(5000),
702
- })
703
- .then(() => undefined)
704
- .catch(() => undefined);
688
+ reportInstallTelemetry(_version) {
689
+ // Install telemetry is a no-op in phi-code: the inherited ping targeted
690
+ // https://pi.dev/api/report-install, the upstream Pi project's endpoint,
691
+ // which both leaked install events to a third party and polluted upstream
692
+ // install stats. phi-code has no telemetry backend of its own.
705
693
  }
706
694
  getMarkdownThemeWithSettings() {
707
695
  return {
@@ -3018,15 +3006,29 @@ export class InteractiveMode {
3018
3006
  this.chatContainer.addChild(new Text(theme.fg("warning", `Warning: ${warningMessage}`), 1, 0));
3019
3007
  this.ui.requestRender();
3020
3008
  }
3021
- showNewVersionNotification(_newVersion) {
3022
- // Update notifications are intentionally disabled: the inherited self-update
3023
- // flow points at the upstream Pi package (earendil-works/pi-coding-agent),
3024
- // not phi-code, so the "Update Available" prompt was misleading and `phi
3025
- // update` broke the install. Re-enable only once self-update targets
3026
- // @phi-code-admin/phi-code.
3009
+ showNewVersionNotification(newVersion) {
3010
+ const action = theme.fg("accent", `${APP_NAME} update`);
3011
+ const updateInstruction = theme.fg("muted", `New version ${newVersion} is available. Run `) + action;
3012
+ const changelogUrl = "https://github.com/uglyswap/phi-code/blob/main/packages/coding-agent/CHANGELOG.md";
3013
+ const changelogLink = getCapabilities().hyperlinks
3014
+ ? hyperlink(theme.fg("accent", "open changelog"), changelogUrl)
3015
+ : theme.fg("accent", changelogUrl);
3016
+ const changelogLine = theme.fg("muted", "Changelog: ") + changelogLink;
3017
+ this.chatContainer.addChild(new Spacer(1));
3018
+ this.chatContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
3019
+ this.chatContainer.addChild(new Text(`${theme.bold(theme.fg("warning", "Update Available"))}\n${updateInstruction}\n${changelogLine}`, 1, 0));
3020
+ this.chatContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
3021
+ this.ui.requestRender();
3027
3022
  }
3028
- showPackageUpdateNotification(_packages) {
3029
- // Disabled together with showNewVersionNotification (see above).
3023
+ showPackageUpdateNotification(packages) {
3024
+ const action = theme.fg("accent", `${APP_NAME} update`);
3025
+ const updateInstruction = theme.fg("muted", "Package updates are available. Run ") + action;
3026
+ const packageLines = packages.map((pkg) => `- ${pkg}`).join("\n");
3027
+ this.chatContainer.addChild(new Spacer(1));
3028
+ this.chatContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
3029
+ this.chatContainer.addChild(new Text(`${theme.bold(theme.fg("warning", "Package Updates Available"))}\n${updateInstruction}\n${theme.fg("muted", "Packages:")}\n${packageLines}`, 1, 0));
3030
+ this.chatContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
3031
+ this.ui.requestRender();
3030
3032
  }
3031
3033
  /**
3032
3034
  * Get all queued messages (read-only).