@phi-code-admin/phi-code 0.84.2 → 0.85.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.
@@ -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";
@@ -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
  }
@@ -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).