@piagent/platform 1.1.9 → 1.2.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.
- package/CHANGELOG.md +175 -1
- package/README.md +2 -2
- package/docs/command-reference-vietnamese.md +19 -5
- package/docs/distribution-standard.md +7 -7
- package/docs/mcp-and-tools.md +154 -2
- package/docs/model-options.md +10 -8
- package/docs/operator-manual-vietnamese.md +25 -13
- package/docs/publishing-for-teams.md +2 -0
- package/docs/quickstart-vietnamese.md +2 -2
- package/docs/release-install-policy.md +6 -6
- package/docs/security-threat-model.md +4 -3
- package/docs/team-onboarding.md +4 -4
- package/docs/usage-observability.md +29 -0
- package/docs/vercel-docs-site.md +34 -4
- package/docs-site/architecture.html +152 -0
- package/docs-site/assets/docs.css +1001 -0
- package/docs-site/assets/docs.js +84 -0
- package/docs-site/commands.html +203 -0
- package/docs-site/content/architecture.html +29 -0
- package/docs-site/content/commands.html +80 -0
- package/docs-site/content/index.html +80 -0
- package/docs-site/content/mcp-approval.html +133 -0
- package/docs-site/content/mcp-auth.html +76 -0
- package/docs-site/content/mcp-servers.html +111 -0
- package/docs-site/content/mcp.html +120 -0
- package/docs-site/content/permissions.html +54 -0
- package/docs-site/content/profiles.html +68 -0
- package/docs-site/content/quickstart.html +144 -0
- package/docs-site/content/runtime.html +45 -0
- package/docs-site/content/scope.html +71 -0
- package/docs-site/content/security.html +51 -0
- package/docs-site/content/team.html +23 -0
- package/docs-site/content/workflows.html +47 -0
- package/docs-site/index.html +131 -1534
- package/docs-site/mcp-approval.html +256 -0
- package/docs-site/mcp-auth.html +199 -0
- package/docs-site/mcp-servers.html +234 -0
- package/docs-site/mcp.html +243 -0
- package/docs-site/permissions.html +177 -0
- package/docs-site/profiles.html +191 -0
- package/docs-site/quickstart.html +267 -0
- package/docs-site/runtime.html +168 -0
- package/docs-site/scope.html +194 -0
- package/docs-site/security.html +174 -0
- package/docs-site/team.html +142 -0
- package/docs-site/workflows.html +170 -0
- package/package.json +4 -2
- package/packages/piagent-core/capabilities/capability-core.js +58 -5
- package/packages/piagent-core/capabilities/capability-sources.js +73 -12
- package/packages/piagent-core/extensions/document-intake.ts +5 -5
- package/packages/piagent-core/extensions/piagent-guard.ts +432 -2
- package/packages/piagent-core/extensions/policy-core.js +1586 -98
- package/packages/piagent-core/mcp/mcp-approval-store.js +216 -0
- package/packages/piagent-core/mcp/mcp-auth-readiness.js +225 -0
- package/packages/piagent-core/mcp/mcp-command-actions.js +400 -0
- package/packages/piagent-core/mcp/mcp-config-layers.js +466 -0
- package/packages/piagent-core/mcp/mcp-import-kinds.js +240 -0
- package/packages/piagent-core/mcp/mcp-server-catalog.js +150 -0
- package/packages/piagent-core/mcp/mcp-server-entry.js +293 -0
- package/packages/piagent-core/mcp/mcp-session-view.js +236 -0
- package/packages/piagent-core/mcp/mcp-tool-naming.js +90 -0
- package/packages/piagent-core/package.json +7 -3
- package/packages/piagent-core/prompts/model-options.md +8 -8
- package/scripts/build-docs-site.mjs +421 -0
- package/scripts/configure-model-scope.sh +21 -5
- package/scripts/configure-subagents.sh +18 -5
- package/scripts/init-project.sh +15 -8
- package/scripts/install-global.sh +5 -5
- package/scripts/mcp-manage.mjs +656 -0
- package/scripts/pi-model-catalog.sh +11 -1
- package/scripts/pi-session-stats.sh +27 -1
- package/scripts/pi-usage-history.mjs +567 -0
- package/scripts/piagent-cli.mjs +1 -1
- package/scripts/preview-docs-site.mjs +88 -0
- package/scripts/quality-benchmark.sh +37 -9
- package/scripts/setup.sh +23 -15
- package/scripts/team-doctor.sh +18 -2
- package/scripts/uninstall-global.sh +10 -4
- package/scripts/verify-local.sh +65 -19
- package/scripts/verify-release-identity.mjs +37 -2
- package/scripts/configure-mcp.sh +0 -349
package/scripts/configure-mcp.sh
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
usage() {
|
|
5
|
-
cat <<'USAGE'
|
|
6
|
-
Usage:
|
|
7
|
-
scripts/configure-mcp.sh [options]
|
|
8
|
-
|
|
9
|
-
Purpose:
|
|
10
|
-
Merge a safe MCP baseline into a standard MCP config file for Pi and other MCP clients.
|
|
11
|
-
Secrets are never written directly; configs reference environment variables.
|
|
12
|
-
|
|
13
|
-
Options:
|
|
14
|
-
--scope <global|pi-global|project|pi-project>
|
|
15
|
-
Config target (default: global)
|
|
16
|
-
--project <path> Project path for project/pi-project scopes (default: current directory)
|
|
17
|
-
--config <path> Explicit config path; overrides --scope/--project
|
|
18
|
-
--preset <minimal|docs|browser|github|design|design-local|web|core|popular|all>
|
|
19
|
-
MCP preset to merge (default: core)
|
|
20
|
-
--replace Replace existing definitions for servers in the preset
|
|
21
|
-
--dry-run Print the merged JSON without writing
|
|
22
|
-
--list Print available presets/servers
|
|
23
|
-
-h, --help
|
|
24
|
-
|
|
25
|
-
Recommended presets:
|
|
26
|
-
core Context7 docs + Chrome DevTools + GitHub
|
|
27
|
-
popular core + Playwright + Figma remote MCP
|
|
28
|
-
all popular + Figma desktop/local MCP
|
|
29
|
-
|
|
30
|
-
Examples:
|
|
31
|
-
piagent-mcp --preset core --scope global --replace
|
|
32
|
-
piagent-mcp --preset popular --scope project --project /path/to/repo
|
|
33
|
-
piagent-mcp --preset design-local --scope project
|
|
34
|
-
|
|
35
|
-
After writing config:
|
|
36
|
-
pi
|
|
37
|
-
/mcp
|
|
38
|
-
/mcp setup
|
|
39
|
-
/mcp reconnect
|
|
40
|
-
USAGE
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
PLATFORM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
44
|
-
SCOPE="global"
|
|
45
|
-
PROJECT_PATH="$PWD"
|
|
46
|
-
CONFIG_PATH=""
|
|
47
|
-
PRESET="core"
|
|
48
|
-
REPLACE=false
|
|
49
|
-
DRY_RUN=false
|
|
50
|
-
LIST=false
|
|
51
|
-
# Answers "is this preset name real?" and writes nothing, so a caller can reject
|
|
52
|
-
# a bad preset before it installs anything.
|
|
53
|
-
VALIDATE_PRESET=false
|
|
54
|
-
|
|
55
|
-
while [[ $# -gt 0 ]]; do
|
|
56
|
-
case "$1" in
|
|
57
|
-
--scope)
|
|
58
|
-
SCOPE="${2:-}"
|
|
59
|
-
shift 2
|
|
60
|
-
;;
|
|
61
|
-
--project)
|
|
62
|
-
PROJECT_PATH="${2:-}"
|
|
63
|
-
shift 2
|
|
64
|
-
;;
|
|
65
|
-
--config)
|
|
66
|
-
CONFIG_PATH="${2:-}"
|
|
67
|
-
shift 2
|
|
68
|
-
;;
|
|
69
|
-
--preset)
|
|
70
|
-
PRESET="${2:-}"
|
|
71
|
-
shift 2
|
|
72
|
-
;;
|
|
73
|
-
--replace)
|
|
74
|
-
REPLACE=true
|
|
75
|
-
shift
|
|
76
|
-
;;
|
|
77
|
-
--dry-run)
|
|
78
|
-
DRY_RUN=true
|
|
79
|
-
shift
|
|
80
|
-
;;
|
|
81
|
-
--list)
|
|
82
|
-
LIST=true
|
|
83
|
-
shift
|
|
84
|
-
;;
|
|
85
|
-
--validate-preset)
|
|
86
|
-
VALIDATE_PRESET=true
|
|
87
|
-
shift
|
|
88
|
-
;;
|
|
89
|
-
-h|--help)
|
|
90
|
-
usage
|
|
91
|
-
exit 0
|
|
92
|
-
;;
|
|
93
|
-
*)
|
|
94
|
-
echo "Unknown option: $1" >&2
|
|
95
|
-
usage >&2
|
|
96
|
-
exit 2
|
|
97
|
-
;;
|
|
98
|
-
esac
|
|
99
|
-
done
|
|
100
|
-
|
|
101
|
-
if [[ -z "$PRESET" ]]; then
|
|
102
|
-
echo "FAIL: --preset cannot be empty" >&2
|
|
103
|
-
exit 2
|
|
104
|
-
fi
|
|
105
|
-
|
|
106
|
-
if [[ -z "$CONFIG_PATH" ]]; then
|
|
107
|
-
case "$SCOPE" in
|
|
108
|
-
global)
|
|
109
|
-
CONFIG_PATH="${XDG_CONFIG_HOME:-"${HOME}/.config"}/mcp/mcp.json"
|
|
110
|
-
;;
|
|
111
|
-
pi-global)
|
|
112
|
-
CONFIG_PATH="${PI_CODING_AGENT_DIR:-"${HOME}/.pi/agent"}/mcp.json"
|
|
113
|
-
;;
|
|
114
|
-
project)
|
|
115
|
-
CONFIG_PATH="$PROJECT_PATH/.mcp.json"
|
|
116
|
-
;;
|
|
117
|
-
pi-project)
|
|
118
|
-
CONFIG_PATH="$PROJECT_PATH/.pi/mcp.json"
|
|
119
|
-
;;
|
|
120
|
-
*)
|
|
121
|
-
echo "FAIL: unsupported scope: $SCOPE" >&2
|
|
122
|
-
usage >&2
|
|
123
|
-
exit 2
|
|
124
|
-
;;
|
|
125
|
-
esac
|
|
126
|
-
fi
|
|
127
|
-
|
|
128
|
-
node --input-type=module - "$CONFIG_PATH" "$PRESET" "$REPLACE" "$DRY_RUN" "$LIST" "$VALIDATE_PRESET" <<'NODE'
|
|
129
|
-
import fs from "node:fs";
|
|
130
|
-
import path from "node:path";
|
|
131
|
-
|
|
132
|
-
const [configPath, presetName, replaceRaw, dryRunRaw, listRaw, validateRaw] = process.argv.slice(2);
|
|
133
|
-
const replace = replaceRaw === "true";
|
|
134
|
-
const dryRun = dryRunRaw === "true";
|
|
135
|
-
const listOnly = listRaw === "true";
|
|
136
|
-
const validateOnly = validateRaw === "true";
|
|
137
|
-
|
|
138
|
-
const baselineSettings = {
|
|
139
|
-
toolPrefix: "server",
|
|
140
|
-
directTools: false,
|
|
141
|
-
idleTimeout: 10,
|
|
142
|
-
outputGuard: true
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const servers = {
|
|
146
|
-
context7: {
|
|
147
|
-
description: "Official Context7 MCP server for up-to-date library/framework docs.",
|
|
148
|
-
config: {
|
|
149
|
-
command: "npx",
|
|
150
|
-
args: ["-y", "@upstash/context7-mcp@3.2.4"],
|
|
151
|
-
env: {
|
|
152
|
-
CONTEXT7_API_KEY: "${CONTEXT7_API_KEY}"
|
|
153
|
-
},
|
|
154
|
-
lifecycle: "lazy",
|
|
155
|
-
directTools: false
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
"chrome-devtools": {
|
|
159
|
-
description: "Chrome DevTools MCP for runtime browser inspection, console logs, screenshots, and performance checks.",
|
|
160
|
-
config: {
|
|
161
|
-
command: "npx",
|
|
162
|
-
args: ["-y", "chrome-devtools-mcp@1.6.0", "--no-performance-crux"],
|
|
163
|
-
env: {
|
|
164
|
-
CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS: "1",
|
|
165
|
-
CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS: "1"
|
|
166
|
-
},
|
|
167
|
-
lifecycle: "lazy",
|
|
168
|
-
directTools: false
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
playwright: {
|
|
172
|
-
description: "Playwright MCP for browser automation and UI verification workflows.",
|
|
173
|
-
config: {
|
|
174
|
-
command: "npx",
|
|
175
|
-
args: ["-y", "@playwright/mcp@0.0.78"],
|
|
176
|
-
lifecycle: "lazy",
|
|
177
|
-
directTools: false
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
github: {
|
|
181
|
-
description: "Official GitHub MCP server via Docker. Requires Docker and GITHUB_PERSONAL_ACCESS_TOKEN when used.",
|
|
182
|
-
config: {
|
|
183
|
-
command: "docker",
|
|
184
|
-
args: [
|
|
185
|
-
"run",
|
|
186
|
-
"-i",
|
|
187
|
-
"--rm",
|
|
188
|
-
"-e",
|
|
189
|
-
"GITHUB_PERSONAL_ACCESS_TOKEN",
|
|
190
|
-
"-e",
|
|
191
|
-
"GITHUB_READ_ONLY=1",
|
|
192
|
-
"-e",
|
|
193
|
-
"GITHUB_LOCKDOWN_MODE=1",
|
|
194
|
-
"ghcr.io/github/github-mcp-server@sha256:2b0c48b070f61e9d3969269ead600f62d00fb237b60ac849ef3d166ee7de9ad3"
|
|
195
|
-
],
|
|
196
|
-
env: {
|
|
197
|
-
GITHUB_PERSONAL_ACCESS_TOKEN: "${GITHUB_PERSONAL_ACCESS_TOKEN}"
|
|
198
|
-
},
|
|
199
|
-
lifecycle: "lazy",
|
|
200
|
-
directTools: false
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
figma: {
|
|
204
|
-
description: "Figma remote MCP server. Requires Figma OAuth from the MCP panel when first used.",
|
|
205
|
-
config: {
|
|
206
|
-
url: "https://mcp.figma.com/mcp",
|
|
207
|
-
auth: "oauth",
|
|
208
|
-
lifecycle: "lazy",
|
|
209
|
-
directTools: false
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
"figma-desktop": {
|
|
213
|
-
description: "Figma desktop/local MCP server. Requires Figma desktop Dev Mode MCP enabled.",
|
|
214
|
-
config: {
|
|
215
|
-
url: "http://127.0.0.1:3845/mcp",
|
|
216
|
-
lifecycle: "lazy",
|
|
217
|
-
directTools: false
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
// Writing a server definition does not make it usable. What each one still
|
|
223
|
-
// needs from the operator is stated here so it can be printed at the moment the
|
|
224
|
-
// definition is written, rather than living only in a description string that
|
|
225
|
-
// shows up under --list.
|
|
226
|
-
const prerequisites = {
|
|
227
|
-
context7: ["optional: export CONTEXT7_API_KEY for a higher documentation quota"],
|
|
228
|
-
"chrome-devtools": ["a local Chrome installation"],
|
|
229
|
-
github: [
|
|
230
|
-
"Docker running",
|
|
231
|
-
"export GITHUB_PERSONAL_ACCESS_TOKEN with the scopes you intend to use"
|
|
232
|
-
],
|
|
233
|
-
playwright: ["browsers installed on first use (npx playwright install)"],
|
|
234
|
-
figma: ["Figma OAuth, completed from the Pi MCP panel on first use"],
|
|
235
|
-
"figma-desktop": ["Figma desktop running with Dev Mode MCP enabled"]
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
const presets = {
|
|
239
|
-
minimal: [],
|
|
240
|
-
docs: ["context7"],
|
|
241
|
-
browser: ["chrome-devtools", "playwright"],
|
|
242
|
-
github: ["github"],
|
|
243
|
-
design: ["figma"],
|
|
244
|
-
"design-local": ["figma-desktop"],
|
|
245
|
-
web: ["context7", "chrome-devtools", "playwright"],
|
|
246
|
-
core: ["context7", "chrome-devtools", "github"],
|
|
247
|
-
popular: ["context7", "chrome-devtools", "playwright", "github", "figma"],
|
|
248
|
-
all: ["context7", "chrome-devtools", "playwright", "github", "figma", "figma-desktop"]
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
if (listOnly) {
|
|
252
|
-
console.log(JSON.stringify({
|
|
253
|
-
presets,
|
|
254
|
-
servers: Object.fromEntries(Object.entries(servers).map(([name, value]) => [
|
|
255
|
-
name,
|
|
256
|
-
{ description: value.description, requires: prerequisites[name] ?? [] }
|
|
257
|
-
]))
|
|
258
|
-
}, null, 2));
|
|
259
|
-
process.exit(0);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (!Object.hasOwn(presets, presetName)) {
|
|
263
|
-
console.error(`FAIL: unknown preset: ${presetName}`);
|
|
264
|
-
console.error(`Available presets: ${Object.keys(presets).join(", ")}`);
|
|
265
|
-
process.exit(2);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Answering the name question and stopping, so a caller can ask before it
|
|
269
|
-
// installs rather than discovering the typo after two packages have landed.
|
|
270
|
-
if (validateOnly) {
|
|
271
|
-
process.stdout.write(`${presetName}\n`);
|
|
272
|
-
process.exit(0);
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
let current = {};
|
|
276
|
-
if (fs.existsSync(configPath)) {
|
|
277
|
-
try {
|
|
278
|
-
current = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
279
|
-
} catch (error) {
|
|
280
|
-
console.error(`FAIL: cannot parse existing MCP config: ${configPath}`);
|
|
281
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
282
|
-
process.exit(1);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (!current || typeof current !== "object" || Array.isArray(current)) current = {};
|
|
287
|
-
if (!current.settings || typeof current.settings !== "object" || Array.isArray(current.settings)) current.settings = {};
|
|
288
|
-
if (!current.mcpServers || typeof current.mcpServers !== "object" || Array.isArray(current.mcpServers)) current.mcpServers = {};
|
|
289
|
-
|
|
290
|
-
current.settings = {
|
|
291
|
-
...baselineSettings,
|
|
292
|
-
...current.settings
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
const added = [];
|
|
296
|
-
const kept = [];
|
|
297
|
-
const replaced = [];
|
|
298
|
-
for (const name of presets[presetName]) {
|
|
299
|
-
if (!Object.hasOwn(servers, name)) {
|
|
300
|
-
throw new Error(`Preset ${presetName} references missing server ${name}`);
|
|
301
|
-
}
|
|
302
|
-
if (Object.hasOwn(current.mcpServers, name)) {
|
|
303
|
-
if (replace) {
|
|
304
|
-
current.mcpServers[name] = servers[name].config;
|
|
305
|
-
replaced.push(name);
|
|
306
|
-
} else {
|
|
307
|
-
kept.push(name);
|
|
308
|
-
}
|
|
309
|
-
} else {
|
|
310
|
-
current.mcpServers[name] = servers[name].config;
|
|
311
|
-
added.push(name);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const output = `${JSON.stringify(current, null, 2)}\n`;
|
|
316
|
-
const report = {
|
|
317
|
-
configPath,
|
|
318
|
-
preset: presetName,
|
|
319
|
-
dryRun,
|
|
320
|
-
replace,
|
|
321
|
-
added,
|
|
322
|
-
kept,
|
|
323
|
-
replaced,
|
|
324
|
-
serverCount: Object.keys(current.mcpServers).length
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
// stdout stays machine-readable; the operator note goes to stderr.
|
|
328
|
-
function reportPrerequisites() {
|
|
329
|
-
const lines = [];
|
|
330
|
-
for (const name of presets[presetName]) {
|
|
331
|
-
for (const item of prerequisites[name] ?? []) lines.push(` ${name}: ${item}`);
|
|
332
|
-
}
|
|
333
|
-
if (lines.length === 0) return;
|
|
334
|
-
console.error("");
|
|
335
|
-
console.error("Server definitions are written. Each still needs this before it can connect:");
|
|
336
|
-
for (const line of lines) console.error(line);
|
|
337
|
-
console.error("Servers connect lazily, so nothing above is checked until the first call.");
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
if (dryRun) {
|
|
341
|
-
console.log(JSON.stringify(report, null, 2));
|
|
342
|
-
console.log(output);
|
|
343
|
-
} else {
|
|
344
|
-
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
345
|
-
fs.writeFileSync(configPath, output);
|
|
346
|
-
console.log(JSON.stringify(report, null, 2));
|
|
347
|
-
reportPrerequisites();
|
|
348
|
-
}
|
|
349
|
-
NODE
|