@codex-infinity/pi-infinity 0.62.1 → 0.62.3

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 (38) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +65 -65
  3. package/dist/config.d.ts +1 -0
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +2 -1
  6. package/dist/config.js.map +1 -1
  7. package/dist/core/agent-session.d.ts +1 -0
  8. package/dist/core/agent-session.d.ts.map +1 -1
  9. package/dist/core/agent-session.js +1 -0
  10. package/dist/core/agent-session.js.map +1 -1
  11. package/dist/core/export-html/index.d.ts.map +1 -1
  12. package/dist/core/export-html/index.js +5 -4
  13. package/dist/core/export-html/index.js.map +1 -1
  14. package/dist/core/package-manager.d.ts.map +1 -1
  15. package/dist/core/package-manager.js +54 -6
  16. package/dist/core/package-manager.js.map +1 -1
  17. package/dist/main.d.ts.map +1 -1
  18. package/dist/main.js +4 -1
  19. package/dist/main.js.map +1 -1
  20. package/dist/modes/interactive/components/bash-execution.d.ts +0 -1
  21. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  22. package/dist/modes/interactive/components/bash-execution.js +18 -4
  23. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  24. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  25. package/dist/modes/interactive/interactive-mode.js +4 -4
  26. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  27. package/dist/modes/print-mode.d.ts +1 -1
  28. package/dist/modes/print-mode.d.ts.map +1 -1
  29. package/dist/modes/print-mode.js +83 -71
  30. package/dist/modes/print-mode.js.map +1 -1
  31. package/docs/rpc.md +11 -2
  32. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  33. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  34. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  35. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  36. package/examples/extensions/with-deps/package-lock.json +2 -2
  37. package/examples/extensions/with-deps/package.json +1 -1
  38. package/package.json +4 -4
@@ -1040,11 +1040,33 @@ export class DefaultPackageManager {
1040
1040
  }
1041
1041
  async getLocalGitUpdateTarget(installedPath) {
1042
1042
  try {
1043
+ const upstream = await this.runCommandCapture("git", ["rev-parse", "--abbrev-ref", "@{upstream}"], {
1044
+ cwd: installedPath,
1045
+ timeoutMs: NETWORK_TIMEOUT_MS,
1046
+ });
1047
+ const trimmedUpstream = upstream.trim();
1048
+ if (!trimmedUpstream.startsWith("origin/")) {
1049
+ throw new Error(`Unsupported upstream remote: ${trimmedUpstream}`);
1050
+ }
1051
+ const branch = trimmedUpstream.slice("origin/".length);
1052
+ if (!branch) {
1053
+ throw new Error("Missing upstream branch name");
1054
+ }
1043
1055
  const head = await this.runCommandCapture("git", ["rev-parse", "@{upstream}"], {
1044
1056
  cwd: installedPath,
1045
1057
  timeoutMs: NETWORK_TIMEOUT_MS,
1046
1058
  });
1047
- return { ref: "@{upstream}", head };
1059
+ return {
1060
+ ref: "@{upstream}",
1061
+ head,
1062
+ fetchArgs: [
1063
+ "fetch",
1064
+ "--prune",
1065
+ "--no-tags",
1066
+ "origin",
1067
+ `+refs/heads/${branch}:refs/remotes/origin/${branch}`,
1068
+ ],
1069
+ };
1048
1070
  }
1049
1071
  catch {
1050
1072
  await this.runCommand("git", ["remote", "set-head", "origin", "-a"], { cwd: installedPath }).catch(() => { });
@@ -1052,7 +1074,29 @@ export class DefaultPackageManager {
1052
1074
  cwd: installedPath,
1053
1075
  timeoutMs: NETWORK_TIMEOUT_MS,
1054
1076
  });
1055
- return { ref: "origin/HEAD", head };
1077
+ const originHeadRef = await this.runCommandCapture("git", ["symbolic-ref", "refs/remotes/origin/HEAD"], {
1078
+ cwd: installedPath,
1079
+ timeoutMs: NETWORK_TIMEOUT_MS,
1080
+ }).catch(() => "");
1081
+ const branch = originHeadRef.trim().replace(/^refs\/remotes\/origin\//, "");
1082
+ if (branch) {
1083
+ return {
1084
+ ref: "origin/HEAD",
1085
+ head,
1086
+ fetchArgs: [
1087
+ "fetch",
1088
+ "--prune",
1089
+ "--no-tags",
1090
+ "origin",
1091
+ `+refs/heads/${branch}:refs/remotes/origin/${branch}`,
1092
+ ],
1093
+ };
1094
+ }
1095
+ return {
1096
+ ref: "origin/HEAD",
1097
+ head,
1098
+ fetchArgs: ["fetch", "--prune", "--no-tags", "origin", "+HEAD:refs/remotes/origin/HEAD"],
1099
+ };
1056
1100
  }
1057
1101
  }
1058
1102
  async getGitUpstreamRef(installedPath) {
@@ -1217,14 +1261,18 @@ export class DefaultPackageManager {
1217
1261
  await this.installGit(source, scope);
1218
1262
  return;
1219
1263
  }
1220
- // Fetch latest from remote (handles force-push by getting new history)
1221
- await this.runCommand("git", ["fetch", "--prune", "origin"], { cwd: targetDir });
1264
+ const target = await this.getLocalGitUpdateTarget(targetDir);
1265
+ // Fetch only the ref we will reset to, avoiding unrelated branch/tag noise.
1266
+ await this.runCommand("git", target.fetchArgs, { cwd: targetDir });
1222
1267
  const localHead = await this.runCommandCapture("git", ["rev-parse", "HEAD"], {
1223
1268
  cwd: targetDir,
1224
1269
  timeoutMs: NETWORK_TIMEOUT_MS,
1225
1270
  });
1226
- const target = await this.getLocalGitUpdateTarget(targetDir);
1227
- if (localHead.trim() === target.head.trim()) {
1271
+ const refreshedTargetHead = await this.runCommandCapture("git", ["rev-parse", target.ref], {
1272
+ cwd: targetDir,
1273
+ timeoutMs: NETWORK_TIMEOUT_MS,
1274
+ });
1275
+ if (localHead.trim() === refreshedTargetHead.trim()) {
1228
1276
  return;
1229
1277
  }
1230
1278
  await this.runCommand("git", ["reset", "--hard", target.ref], { cwd: targetDir });