@piagent/platform 1.45.0 → 1.46.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.
Files changed (97) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +5 -3
  3. package/README.vi.md +5 -3
  4. package/docs/command-reference-vietnamese.md +2 -2
  5. package/docs/distribution-standard.md +6 -6
  6. package/docs/en/architecture.md +1 -1
  7. package/docs/harness-conformance.md +22 -5
  8. package/docs/languages.json +4 -4
  9. package/docs/operator-manual-vietnamese.md +7 -7
  10. package/docs/publishing-for-teams.md +2 -0
  11. package/docs/release-install-policy.md +2 -2
  12. package/docs/team-onboarding.md +2 -2
  13. package/docs/vi/architecture.md +1 -1
  14. package/docs-site/architecture.html +1 -1
  15. package/docs-site/assets/search-en.json +1 -1
  16. package/docs-site/assets/search-vi.json +1 -1
  17. package/docs-site/benchmark.html +1 -1
  18. package/docs-site/commands.html +1 -1
  19. package/docs-site/context-engine.html +1 -1
  20. package/docs-site/ecosystem.html +1 -1
  21. package/docs-site/en/architecture.html +1 -1
  22. package/docs-site/en/benchmark.html +1 -1
  23. package/docs-site/en/commands.html +1 -1
  24. package/docs-site/en/context-engine.html +1 -1
  25. package/docs-site/en/ecosystem.html +1 -1
  26. package/docs-site/en/index.html +15 -15
  27. package/docs-site/en/mcp-approval.html +1 -1
  28. package/docs-site/en/mcp-auth.html +1 -1
  29. package/docs-site/en/mcp-servers.html +1 -1
  30. package/docs-site/en/mcp.html +1 -1
  31. package/docs-site/en/permissions.html +1 -1
  32. package/docs-site/en/profiles.html +1 -1
  33. package/docs-site/en/quickstart.html +1 -1
  34. package/docs-site/en/runtime.html +1 -1
  35. package/docs-site/en/scope.html +1 -1
  36. package/docs-site/en/security.html +1 -1
  37. package/docs-site/en/team.html +1 -1
  38. package/docs-site/en/update.html +3 -3
  39. package/docs-site/en/whats-new.html +55 -29
  40. package/docs-site/en/windows.html +1 -1
  41. package/docs-site/en/workflows.html +1 -1
  42. package/docs-site/index.html +15 -15
  43. package/docs-site/mcp-approval.html +1 -1
  44. package/docs-site/mcp-auth.html +1 -1
  45. package/docs-site/mcp-servers.html +1 -1
  46. package/docs-site/mcp.html +1 -1
  47. package/docs-site/permissions.html +1 -1
  48. package/docs-site/profiles.html +1 -1
  49. package/docs-site/quickstart.html +1 -1
  50. package/docs-site/releases.json +83 -0
  51. package/docs-site/runtime.html +1 -1
  52. package/docs-site/scope.html +1 -1
  53. package/docs-site/security.html +1 -1
  54. package/docs-site/team.html +1 -1
  55. package/docs-site/update.html +3 -3
  56. package/docs-site/whats-new.html +55 -29
  57. package/docs-site/windows.html +1 -1
  58. package/docs-site/workflows.html +1 -1
  59. package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
  60. package/package.json +1 -1
  61. package/packages/piagent-core/benchmark/benchmark-bootstrap.js +3 -1
  62. package/packages/piagent-core/extensions/agent-home.d.ts +4 -0
  63. package/packages/piagent-core/extensions/agent-home.js +52 -0
  64. package/packages/piagent-core/extensions/piagent-guard.ts +5 -1
  65. package/packages/piagent-core/managed/copies.mjs +61 -0
  66. package/packages/piagent-core/managed/grant-share.mjs +9 -1
  67. package/packages/piagent-core/managed/helper-roles.mjs +5 -3
  68. package/packages/piagent-core/managed/helper-run.mjs +120 -52
  69. package/packages/piagent-core/managed/helper-settlement.mjs +5 -1
  70. package/packages/piagent-core/managed/ledger.mjs +187 -0
  71. package/packages/piagent-core/managed/objections.mjs +49 -27
  72. package/packages/piagent-core/managed/patch-snapshot.mjs +9 -0
  73. package/packages/piagent-core/managed/session.mjs +14 -14
  74. package/packages/piagent-core/managed/toolchain.mjs +7 -3
  75. package/packages/piagent-core/managed/workflow.mjs +32 -26
  76. package/packages/piagent-core/mcp/mcp-config-layers.js +4 -1
  77. package/packages/piagent-core/package.json +1 -1
  78. package/packages/piagent-core/runtime/managed-failure.mjs +8 -0
  79. package/packages/piagent-webui/extension/piagent-webui.ts +2 -0
  80. package/packages/piagent-webui/gateway/gateway-service.ts +4 -1
  81. package/packages/piagent-webui/gateway/pi-host.ts +2 -2
  82. package/packages/piagent-webui/ownership/profile-state.ts +10 -1
  83. package/packages/piagent-webui/server/benchmark-release-monitor.ts +2 -1
  84. package/scripts/benchmark-runner-support.mjs +2 -1
  85. package/scripts/company-terminal.mjs +19 -1
  86. package/scripts/dashboard-update-job.mjs +4 -2
  87. package/scripts/install-global.sh +113 -5
  88. package/scripts/model-scope-prune.mjs +2 -1
  89. package/scripts/personal-pi-config.mjs +2 -1
  90. package/scripts/personal-pi-restore.mjs +184 -0
  91. package/scripts/pi-usage-history.mjs +2 -1
  92. package/scripts/piagent-cli.mjs +49 -9
  93. package/scripts/piagent-dashboard.mjs +5 -3
  94. package/scripts/setup.sh +2 -6
  95. package/scripts/team-doctor.sh +11 -5
  96. package/scripts/uninstall-global.sh +17 -2
  97. package/scripts/update-global.mjs +5 -2
@@ -72,8 +72,14 @@ const installations = piagentInstallations();
72
72
  if(installations.length>1) warnings.push("Multiple Piagent installations detected. Use the pinned Watch launcher; other PATHs may run an older build: "+installations.map(i=>`${i.version} [${i.fingerprint}] ${i.root}`).join("; "));
73
73
  // Personal Pi loading Piagent twice does not start; old company providers send it to Studio outside the Harness.
74
74
  const { inspect: inspectPersonalPi } = await import(pathToFileURL(path.join(platformRoot, "scripts/personal-pi-config.mjs")).href);
75
- for (const finding of inspectPersonalPi(process.env.PI_CODING_AGENT_DIR || path.join(process.env.HOME || "", ".pi", "agent")).findings)
76
- (finding.kind === "duplicate-extensions" ? errors : warnings).push(`personal Pi: ${finding.text} Fix: piagent-update`);
75
+ const personalPiDir = path.join(process.env.HOME || "", ".pi", "agent");
76
+ for (const agentDir of new Set([personalPiDir, process.env.PI_CODING_AGENT_DIR || personalPiDir]))
77
+ for (const finding of inspectPersonalPi(agentDir).findings)
78
+ (finding.kind === "duplicate-extensions" ? errors : warnings).push(`${agentDir === personalPiDir ? "personal Pi" : "Piagent home"}: ${finding.text} Fix: piagent-update`);
79
+ // Since 1.46 Piagent runs from its own home; an older install left in personal Pi keeps loading there.
80
+ const { plan: personalPiRestorePlan } = await import(pathToFileURL(path.join(platformRoot, "scripts/personal-pi-restore.mjs")).href);
81
+ if (personalPiRestorePlan({ personalDir: personalPiDir }).legacy)
82
+ warnings.push("personal Pi still loads an older Piagent install (~/.pi/agent). Fix: piagent restore-pi --apply");
77
83
  const { verifyCapabilityLock } = await import(pathToFileURL(path.join(platformRoot, "packages", "piagent-core", "capabilities", "capability-core.js")).href);
78
84
 
79
85
  function exists(rel) {
@@ -271,9 +277,9 @@ if (commandExists("pi")) {
271
277
  piHasMcpAdapter = combined.includes("pi-mcp-adapter");
272
278
  piHasSubagents = combined.includes("pi-subagents");
273
279
  piHasWebAccess = combined.includes("pi-web-access");
274
- if (!piHasMcpAdapter) warnings.push("Pi MCP adapter not found in `pi list`; run setup with --with-mcp or `pi install npm:pi-mcp-adapter@2.15.0`");
275
- if (!piHasSubagents) warnings.push("Pi subagents package not found in `pi list`; run setup with --with-subagents or `pi install npm:pi-subagents@0.38.0`");
276
- if (!piHasWebAccess) warnings.push("Pi web access package not found in `pi list`; run `piagent-update --force` or `pi install npm:pi-web-access@0.17.0` so researcher subagents can browse/fetch external sources");
280
+ if (!piHasMcpAdapter) warnings.push("Pi MCP adapter not found in `pi list`; run `piagent-install --with-mcp` (installs into Piagent's home, not your personal pi)");
281
+ if (!piHasSubagents) warnings.push("Pi subagents package not found in `pi list`; run `piagent-install --with-subagents` if you want them");
282
+ if (!piHasWebAccess) warnings.push("Pi web access package not found in `pi list`; run `piagent-install --with-web-access` so researcher subagents can browse/fetch external sources");
277
283
  }
278
284
 
279
285
  const mcpFiles = [
@@ -9,7 +9,16 @@ set -euo pipefail
9
9
  # deleted.
10
10
 
11
11
  ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
12
- PI_AGENT_DIR="${PI_CODING_AGENT_DIR:-"${HOME}/.pi/agent"}"
12
+ # Piagent's own Pi home (same rule as packages/piagent-core/extensions/agent-home.js).
13
+ PERSONAL_PI_DIR="${HOME}/.pi/agent"
14
+ if [[ -n "${PIAGENT_AGENT_DIR:-}" ]]; then
15
+ PI_AGENT_DIR="$PIAGENT_AGENT_DIR"
16
+ elif [[ -n "${PI_CODING_AGENT_DIR:-}" && "${PI_CODING_AGENT_DIR%/}" != "$PERSONAL_PI_DIR" ]]; then
17
+ PI_AGENT_DIR="$PI_CODING_AGENT_DIR"
18
+ else
19
+ PI_AGENT_DIR="${HOME}/.piagent/agent"
20
+ fi
21
+ export PI_CODING_AGENT_DIR="$PI_AGENT_DIR"
13
22
  GLOBAL_SETTINGS="$PI_AGENT_DIR/settings.json"
14
23
 
15
24
  APPLY=false
@@ -26,7 +35,9 @@ usage() {
26
35
  Usage:
27
36
  piagent-uninstall [--apply] [--with-addons] [--with-host] [--project <path>]
28
37
 
29
- Removes the Pi package this platform installed from Pi's global settings.
38
+ Removes the Pi package this platform installed from Piagent's own Pi home
39
+ (~/.piagent/agent). An install from before 1.46 lives in your personal pi
40
+ (~/.pi/agent): `piagent restore-pi --apply` takes it out of there.
30
41
 
31
42
  (default) Dry run. Reports what would be removed and exits 0.
32
43
  --apply Perform the removal.
@@ -291,6 +302,10 @@ NODE
291
302
  fi
292
303
 
293
304
  echo
305
+ if node "$ROOT/scripts/personal-pi-restore.mjs" --json 2>/dev/null | grep -q '"legacy": true'; then
306
+ echo "Your personal pi ($PERSONAL_PI_DIR) still loads an older Piagent install."
307
+ echo " Take it out with: piagent restore-pi --apply"
308
+ fi
294
309
  if [[ "$APPLY" == true ]]; then
295
310
  echo "Uninstall complete."
296
311
  echo "The npm-global helper is separate and stays until you remove it:"
@@ -22,6 +22,7 @@ import path from "node:path";
22
22
  import { spawnSync } from "node:child_process";
23
23
  import { fileURLToPath } from "node:url";
24
24
  import { inspect as inspectPersonalPi } from "./personal-pi-config.mjs";
25
+ import { personalPiAgentDir, piagentAgentDir } from "../packages/piagent-core/extensions/agent-home.js";
25
26
  import { hostPlan, installPrivateHost, privateHostRoot } from "../packages/piagent-core/managed/pi-host.mjs";
26
27
 
27
28
  const HELPER_PACKAGE = "@piagent/platform";
@@ -438,8 +439,10 @@ function main() {
438
439
  : ` host: ${currentHost ?? "not installed"} -> ${targetHost}${hostNeedsChange ? "" : " (already current)"}`);
439
440
  // The Pi package can lag the helper (installed from an older tag), and
440
441
  // personal Pi can hold conflicting Piagent or old company entries.
441
- const personal = inspectPersonalPi(process.env.PI_CODING_AGENT_DIR || path.join(os.homedir(), ".pi", "agent"));
442
- const installedPackages = personal.packages.map((item) => item.version ?? "unknown");
442
+ // The package lives in Piagent's home; old company entries and an older
443
+ // Piagent install live in the member's personal pi.
444
+ const personal = inspectPersonalPi(personalPiAgentDir()), own = inspectPersonalPi(piagentAgentDir());
445
+ const installedPackages = own.packages.map((item) => item.version ?? "unknown");
443
446
  const packageNeedsChange = options.package && (options.force || installedPackages.length !== 1 || installedPackages[0] !== targetHelper);
444
447
  console.log(` package: ${installedPackages.join(", ") || "not installed"} -> v${targetHelper}${options.package ? packageNeedsChange ? " (reinstalled as a resolved commit)" : " (already current)" : " (skipped)"}`);
445
448
  for (const finding of personal.findings) console.log(` personal Pi: ${finding.text}`);