@piagent/platform 1.46.1 → 1.46.4
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/CHANGELOG.md +42 -0
- package/docs/command-reference-vietnamese.md +2 -2
- package/docs/distribution-standard.md +6 -6
- package/docs/operator-manual-vietnamese.md +7 -7
- package/docs/publishing-for-teams.md +3 -0
- package/docs/release-install-policy.md +2 -2
- package/docs/team-onboarding.md +2 -2
- package/docs-site/architecture.html +1 -1
- package/docs-site/assets/search-en.json +1 -1
- package/docs-site/assets/search-vi.json +1 -1
- package/docs-site/benchmark.html +1 -1
- package/docs-site/commands.html +1 -1
- package/docs-site/context-engine.html +1 -1
- package/docs-site/ecosystem.html +1 -1
- package/docs-site/en/architecture.html +1 -1
- package/docs-site/en/benchmark.html +1 -1
- package/docs-site/en/commands.html +1 -1
- package/docs-site/en/context-engine.html +1 -1
- package/docs-site/en/ecosystem.html +1 -1
- package/docs-site/en/index.html +15 -15
- package/docs-site/en/mcp-approval.html +1 -1
- package/docs-site/en/mcp-auth.html +1 -1
- package/docs-site/en/mcp-servers.html +1 -1
- package/docs-site/en/mcp.html +1 -1
- package/docs-site/en/permissions.html +1 -1
- package/docs-site/en/profiles.html +1 -1
- package/docs-site/en/quickstart.html +1 -1
- package/docs-site/en/runtime.html +1 -1
- package/docs-site/en/scope.html +1 -1
- package/docs-site/en/security.html +1 -1
- package/docs-site/en/team.html +1 -1
- package/docs-site/en/update.html +3 -3
- package/docs-site/en/whats-new.html +77 -46
- package/docs-site/en/windows.html +1 -1
- package/docs-site/en/workflows.html +1 -1
- package/docs-site/index.html +15 -15
- package/docs-site/mcp-approval.html +1 -1
- package/docs-site/mcp-auth.html +1 -1
- package/docs-site/mcp-servers.html +1 -1
- package/docs-site/mcp.html +1 -1
- package/docs-site/permissions.html +1 -1
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +1 -1
- package/docs-site/releases.json +93 -0
- package/docs-site/runtime.html +1 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/update.html +3 -3
- package/docs-site/whats-new.html +77 -46
- package/docs-site/windows.html +1 -1
- package/docs-site/workflows.html +1 -1
- package/evals/private-holdout-v1/public-exposure.v2.json +1 -1
- package/package.json +1 -1
- package/packages/piagent-core/extensions/piagent-guard.ts +4 -1
- package/packages/piagent-core/managed/copies.mjs +14 -4
- package/packages/piagent-core/managed/session.mjs +3 -3
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/runtime/hooks/session-hooks.ts +6 -0
- package/packages/piagent-core/runtime/managed-failure.mjs +0 -1
- package/packages/piagent-webui/gateway/gateway-session-stream.ts +24 -0
- package/scripts/claude-model-additions.mjs +8 -1
- package/scripts/configure-model-scope.sh +6 -1
- package/scripts/install-global.sh +10 -4
- package/scripts/personal-pi-config.mjs +5 -2
- package/scripts/pi-models-json.mjs +13 -0
|
@@ -15,11 +15,14 @@ import fs from "node:fs";
|
|
|
15
15
|
import os from "node:os";
|
|
16
16
|
import path from "node:path";
|
|
17
17
|
import { fileURLToPath } from "node:url";
|
|
18
|
+
import { parsePiModelsJson } from "./pi-models-json.mjs";
|
|
18
19
|
|
|
19
20
|
const COMPANY_PROVIDER = /^agent_watch_/;
|
|
20
21
|
const SESSION_HEADER_EXTENSION = "agentwatch-studio-session.mjs";
|
|
21
22
|
|
|
22
23
|
const readJson = (file) => { try { return JSON.parse(fs.readFileSync(file, "utf8")); } catch { return null; } };
|
|
24
|
+
// models.json may carry comments, as Pi allows; a strict read would miss company providers in it.
|
|
25
|
+
const readModels = (file) => { try { return parsePiModelsJson(fs.readFileSync(file, "utf8")).data; } catch { return null; } };
|
|
23
26
|
const real = (file) => { try { return fs.realpathSync(file); } catch { return null; } };
|
|
24
27
|
|
|
25
28
|
// The Piagent package a path belongs to (its root), or null.
|
|
@@ -47,7 +50,7 @@ export function packageVersion(agentDir, source) {
|
|
|
47
50
|
|
|
48
51
|
export function inspect(agentDir) {
|
|
49
52
|
const settingsFile = path.join(agentDir, "settings.json"), modelsFile = path.join(agentDir, "models.json");
|
|
50
|
-
const settings = readJson(settingsFile) ?? {}, models =
|
|
53
|
+
const settings = readJson(settingsFile) ?? {}, models = readModels(modelsFile) ?? {};
|
|
51
54
|
const managed = fs.existsSync(path.join(agentDir, "agent-watch-managed.json"));
|
|
52
55
|
const packages = Array.isArray(settings.packages) ? settings.packages : [];
|
|
53
56
|
const piagentPackages = packages.filter(isPiagentSource);
|
|
@@ -109,7 +112,7 @@ export function repair(agentDir, now = new Date()) {
|
|
|
109
112
|
backups.push(backup(settingsFile, stamp)); writeJson(settingsFile, settings); changed.push(settingsFile);
|
|
110
113
|
}
|
|
111
114
|
if (kinds.has("company-providers")) {
|
|
112
|
-
const models =
|
|
115
|
+
const models = readModels(modelsFile);
|
|
113
116
|
for (const name of Object.keys(models.providers ?? {})) if (COMPANY_PROVIDER.test(name)) delete models.providers[name];
|
|
114
117
|
backups.push(backup(modelsFile, stamp)); writeJson(modelsFile, models); changed.push(modelsFile);
|
|
115
118
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Pi reads models.json leniently: a BOM, `//` line comments and trailing
|
|
2
|
+
// commas are allowed (Pi's stripJsonComments). Piagent reads it the same way,
|
|
3
|
+
// and says whether the text was plain JSON, so a writer knows it would drop
|
|
4
|
+
// the member's comments.
|
|
5
|
+
const stripComments = text => text
|
|
6
|
+
.replace(/"(?:\\.|[^"\\])*"|\/\/[^\n]*/g, m => (m[0] === '"' ? m : ""))
|
|
7
|
+
.replace(/"(?:\\.|[^"\\])*"|,(\s*[}\]])/g, (m, tail) => tail ?? (m[0] === '"' ? m : ""));
|
|
8
|
+
|
|
9
|
+
export function parsePiModelsJson(text) {
|
|
10
|
+
const body = text.replace(/^\uFEFF/, "");
|
|
11
|
+
try { return { data: JSON.parse(body), strict: true }; }
|
|
12
|
+
catch { return { data: JSON.parse(stripComments(body)), strict: false }; }
|
|
13
|
+
}
|