@piagent/platform 1.0.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.
- package/.gitattributes +7 -0
- package/AGENTS.md +31 -0
- package/CHANGELOG.md +296 -0
- package/CODE_OF_CONDUCT.md +36 -0
- package/CONTRIBUTING.md +66 -0
- package/LICENSE +21 -0
- package/README.md +588 -0
- package/SECURITY.md +38 -0
- package/adapters/backend-api/profile.json +88 -0
- package/adapters/be-readonly-fe/profile.json +120 -0
- package/adapters/data/profile.json +88 -0
- package/adapters/devops/profile.json +92 -0
- package/adapters/docs/profile.json +74 -0
- package/adapters/fullstack/profile.json +94 -0
- package/adapters/generic/profile.json +95 -0
- package/adapters/mobile/profile.json +87 -0
- package/adapters/node-typescript/profile.json +76 -0
- package/adapters/python/profile.json +75 -0
- package/adapters/web-frontend/profile.json +101 -0
- package/catalog/capabilities.json +206 -0
- package/docs/architecture.md +64 -0
- package/docs/auto-delegation-policy.md +192 -0
- package/docs/capability-packs.md +234 -0
- package/docs/command-reference-vietnamese.md +484 -0
- package/docs/context-window-policy.md +85 -0
- package/docs/distribution-standard.md +229 -0
- package/docs/herdr-workflow.md +58 -0
- package/docs/mcp-and-tools.md +316 -0
- package/docs/memory-policy.md +164 -0
- package/docs/model-options.md +165 -0
- package/docs/oauth-providers.md +53 -0
- package/docs/operator-manual-vietnamese.md +1080 -0
- package/docs/package-architecture-notes.md +101 -0
- package/docs/project-adapters.md +174 -0
- package/docs/project-onboarding.md +135 -0
- package/docs/publishing-for-teams.md +64 -0
- package/docs/quality-benchmark.md +74 -0
- package/docs/quickstart-vietnamese.md +350 -0
- package/docs/release-install-policy.md +223 -0
- package/docs/runtime-harness-standard.md +118 -0
- package/docs/runtime-policy-design.md +132 -0
- package/docs/runtime-quality-baseline.md +257 -0
- package/docs/security-redaction-benchmark.md +56 -0
- package/docs/security-threat-model.md +66 -0
- package/docs/subagent-orchestration-capabilities.md +104 -0
- package/docs/subagents-and-multiagent.md +346 -0
- package/docs/task-implementation-contract.md +200 -0
- package/docs/team-onboarding.md +333 -0
- package/docs/usage-observability.md +130 -0
- package/docs/vercel-docs-site.md +115 -0
- package/docs/workflow-recipes.md +125 -0
- package/docs-site/assets/piagent-logo.svg +35 -0
- package/docs-site/favicon.svg +18 -0
- package/docs-site/index.html +1613 -0
- package/docs-site/vercel.json +24 -0
- package/evals/fixtures/action-proposal.invalid.json +34 -0
- package/evals/fixtures/action-proposal.valid.json +34 -0
- package/evals/fixtures/capability-pack.invalid.json +123 -0
- package/evals/fixtures/capability-pack.valid.json +123 -0
- package/evals/fixtures/capability-recipe.invalid.json +81 -0
- package/evals/fixtures/capability-recipe.valid.json +82 -0
- package/evals/fixtures/context-index.invalid.json +25 -0
- package/evals/fixtures/context-index.valid.json +25 -0
- package/evals/fixtures/eval-scenario.invalid.json +40 -0
- package/evals/fixtures/eval-scenario.valid.json +45 -0
- package/evals/fixtures/project-profile.invalid.json +88 -0
- package/evals/fixtures/project-profile.valid.json +95 -0
- package/evals/fixtures/task-contract.invalid.json +73 -0
- package/evals/fixtures/task-contract.valid.json +74 -0
- package/evals/golden/enforcement-decisions.json +329 -0
- package/evals/scenarios/capability-resolution.json +45 -0
- package/package.json +132 -0
- package/packages/piagent-core/README.md +147 -0
- package/packages/piagent-core/capabilities/capability-core.js +1023 -0
- package/packages/piagent-core/capabilities/capability-sources.js +265 -0
- package/packages/piagent-core/extensions/guard-io.js +45 -0
- package/packages/piagent-core/extensions/guard-shell-analysis.ts +558 -0
- package/packages/piagent-core/extensions/guard-types.ts +406 -0
- package/packages/piagent-core/extensions/piagent-guard.ts +5760 -0
- package/packages/piagent-core/extensions/policy-core.js +1070 -0
- package/packages/piagent-core/extensions/redaction-core.js +4 -0
- package/packages/piagent-core/extensions/runtime-evidence.js +215 -0
- package/packages/piagent-core/package.json +46 -0
- package/packages/piagent-core/policies/base-policy.json +249 -0
- package/packages/piagent-core/prompts/be-to-fe.md +82 -0
- package/packages/piagent-core/prompts/commit.md +27 -0
- package/packages/piagent-core/prompts/discuss.md +35 -0
- package/packages/piagent-core/prompts/memory-policy.md +52 -0
- package/packages/piagent-core/prompts/model-options.md +68 -0
- package/packages/piagent-core/prompts/onboard-project.md +147 -0
- package/packages/piagent-core/prompts/piagent-commands.md +68 -0
- package/packages/piagent-core/prompts/plan.md +35 -0
- package/packages/piagent-core/prompts/platform-improve.md +69 -0
- package/packages/piagent-core/prompts/pr.md +26 -0
- package/packages/piagent-core/prompts/review.md +38 -0
- package/packages/piagent-core/prompts/scout.md +50 -0
- package/packages/piagent-core/prompts/task.md +69 -0
- package/packages/piagent-core/security/sensitive-data.js +187 -0
- package/packages/piagent-core/skills/piagent-ops/SKILL.md +44 -0
- package/packages/piagent-core/skills/piagent-source-cache/SKILL.md +59 -0
- package/packages/piagent-core/skills/piagent-source-cache/checkout-source-repo.sh +144 -0
- package/packages/piagent-core/subagents/piagent-oracle.md +29 -0
- package/packages/piagent-core/subagents/piagent-planner.md +46 -0
- package/packages/piagent-core/subagents/piagent-reviewer.md +48 -0
- package/packages/piagent-core/subagents/piagent-scout.md +37 -0
- package/packages/piagent-core/subagents/piagent-worker.md +44 -0
- package/packs/engineering-base/pack.json +123 -0
- package/packs/engineering-base/recipes/bounded-change.json +82 -0
- package/packs/web-delivery/pack.json +72 -0
- package/packs/web-delivery/recipes/verified-web-change.json +57 -0
- package/schemas/action-proposal.schema.json +90 -0
- package/schemas/capability-pack.schema.json +190 -0
- package/schemas/capability-recipe.schema.json +72 -0
- package/schemas/context-index.schema.json +258 -0
- package/schemas/eval-scenario.schema.json +67 -0
- package/schemas/project-profile.schema.json +555 -0
- package/schemas/task-contract.schema.json +314 -0
- package/scripts/audit-runtime-host.sh +78 -0
- package/scripts/bootstrap-local.sh +25 -0
- package/scripts/capability-catalog.mjs +290 -0
- package/scripts/check-runtime-advisories.mjs +114 -0
- package/scripts/configure-mcp.sh +301 -0
- package/scripts/configure-model-scope.sh +143 -0
- package/scripts/configure-subagents.sh +241 -0
- package/scripts/import-agent-instructions.mjs +199 -0
- package/scripts/init-project.sh +369 -0
- package/scripts/install-global.sh +532 -0
- package/scripts/link-project.sh +25 -0
- package/scripts/migrate-project-state.mjs +176 -0
- package/scripts/pi-auto.sh +79 -0
- package/scripts/pi-model-catalog.sh +154 -0
- package/scripts/pi-session-stats.sh +135 -0
- package/scripts/piagent-cli.mjs +53 -0
- package/scripts/profile-doctor.sh +238 -0
- package/scripts/quality-benchmark.sh +185 -0
- package/scripts/redaction-benchmark.mjs +227 -0
- package/scripts/runtime-policy-smoke.sh +48 -0
- package/scripts/setup.sh +425 -0
- package/scripts/team-doctor.sh +461 -0
- package/scripts/verify-local.sh +540 -0
- package/scripts/verify-release-identity.mjs +85 -0
- package/scripts/verify-vercel-link.mjs +64 -0
- package/templates/global/mcp.json +9 -0
- package/templates/global/settings.json +37 -0
- package/templates/project/.mcp.json +9 -0
- package/templates/project/.pi/context-index.json +25 -0
- package/templates/project/.pi/gitignore.template +22 -0
- package/templates/project/.pi/mcp.json +9 -0
- package/templates/project/.pi/memory/MEMORY.md +11 -0
- package/templates/project/.pi/memory/memory_summary.md +9 -0
- package/templates/project/.pi/piagent-profile.json +107 -0
- package/templates/project/.pi/project-context.md +30 -0
- package/templates/project/.pi/settings.json +17 -0
- package/templates/project/.pi/task-contract.template.json +74 -0
- package/templates/project/.pi/tech-context/README.md +7 -0
- package/templates/project/.pi/tech-stack.json +10 -0
- package/templates/project/AGENTS.md +34 -0
- package/templates/project/REVIEW_GUIDELINES.md +23 -0
- package/types/pi-runtime-shims.d.ts +13 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/Vt-mmm/piagent/schemas/task-contract.schema.json",
|
|
4
|
+
"title": "Pi Agent Task Implementation Contract",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": [
|
|
7
|
+
"taskId",
|
|
8
|
+
"summary",
|
|
9
|
+
"riskLane",
|
|
10
|
+
"expectedOutput",
|
|
11
|
+
"acceptanceCriteria",
|
|
12
|
+
"scope",
|
|
13
|
+
"outOfScope",
|
|
14
|
+
"protectedPaths",
|
|
15
|
+
"requiredContext",
|
|
16
|
+
"contextManifest",
|
|
17
|
+
"memoryCitations",
|
|
18
|
+
"verifyCommands",
|
|
19
|
+
"changedFiles",
|
|
20
|
+
"verifyEvidence",
|
|
21
|
+
"trace"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"taskId": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"minLength": 1
|
|
27
|
+
},
|
|
28
|
+
"summary": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"minLength": 10
|
|
31
|
+
},
|
|
32
|
+
"riskLane": {
|
|
33
|
+
"enum": [
|
|
34
|
+
"tiny",
|
|
35
|
+
"normal",
|
|
36
|
+
"high-risk"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"expectedOutput": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"minLength": 10
|
|
42
|
+
},
|
|
43
|
+
"acceptanceCriteria": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"minLength": 1
|
|
48
|
+
},
|
|
49
|
+
"minItems": 1
|
|
50
|
+
},
|
|
51
|
+
"scope": {
|
|
52
|
+
"type": "array",
|
|
53
|
+
"items": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"minLength": 1
|
|
56
|
+
},
|
|
57
|
+
"minItems": 1
|
|
58
|
+
},
|
|
59
|
+
"outOfScope": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"minLength": 1
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"protectedPaths": {
|
|
67
|
+
"type": "array",
|
|
68
|
+
"items": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"minLength": 1
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"requiredContext": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"items": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"minLength": 1
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"contextManifest": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"items": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"required": [
|
|
85
|
+
"path",
|
|
86
|
+
"reason"
|
|
87
|
+
],
|
|
88
|
+
"properties": {
|
|
89
|
+
"path": {
|
|
90
|
+
"type": "string"
|
|
91
|
+
},
|
|
92
|
+
"reason": {
|
|
93
|
+
"type": "string"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"additionalProperties": true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"memoryCitations": {
|
|
100
|
+
"type": "array",
|
|
101
|
+
"items": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"required": [
|
|
104
|
+
"path",
|
|
105
|
+
"reason"
|
|
106
|
+
],
|
|
107
|
+
"properties": {
|
|
108
|
+
"path": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"minLength": 1
|
|
111
|
+
},
|
|
112
|
+
"reason": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"minLength": 1
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"additionalProperties": false
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"mcpCapabilities": {
|
|
121
|
+
"type": "array",
|
|
122
|
+
"items": {
|
|
123
|
+
"type": "string"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"verifyCommands": {
|
|
127
|
+
"type": "array",
|
|
128
|
+
"items": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"minLength": 1
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"workPlan": {
|
|
134
|
+
"type": "array",
|
|
135
|
+
"description": "Optional solo-first task tree for parent/subagent coordination.",
|
|
136
|
+
"maxItems": 12,
|
|
137
|
+
"items": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"required": [
|
|
140
|
+
"id",
|
|
141
|
+
"title",
|
|
142
|
+
"role",
|
|
143
|
+
"mode",
|
|
144
|
+
"status"
|
|
145
|
+
],
|
|
146
|
+
"properties": {
|
|
147
|
+
"id": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"minLength": 1,
|
|
150
|
+
"maxLength": 40
|
|
151
|
+
},
|
|
152
|
+
"title": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"minLength": 1,
|
|
155
|
+
"maxLength": 160
|
|
156
|
+
},
|
|
157
|
+
"role": {
|
|
158
|
+
"enum": [
|
|
159
|
+
"parent",
|
|
160
|
+
"piagent-scout",
|
|
161
|
+
"piagent-planner",
|
|
162
|
+
"piagent-worker",
|
|
163
|
+
"piagent-reviewer",
|
|
164
|
+
"piagent-oracle"
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
"mode": {
|
|
168
|
+
"enum": [
|
|
169
|
+
"read-only",
|
|
170
|
+
"single-writer",
|
|
171
|
+
"review"
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"status": {
|
|
175
|
+
"enum": [
|
|
176
|
+
"pending",
|
|
177
|
+
"in-progress",
|
|
178
|
+
"done",
|
|
179
|
+
"skipped"
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
"dependsOn": {
|
|
183
|
+
"type": "array",
|
|
184
|
+
"items": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"minLength": 1,
|
|
187
|
+
"maxLength": 40
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"additionalProperties": false
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"reviewLenses": {
|
|
195
|
+
"type": "array",
|
|
196
|
+
"description": "Explicit review lenses for the task, used instead of blanket swarm review.",
|
|
197
|
+
"uniqueItems": true,
|
|
198
|
+
"items": {
|
|
199
|
+
"enum": [
|
|
200
|
+
"correctness",
|
|
201
|
+
"tests",
|
|
202
|
+
"scope",
|
|
203
|
+
"security",
|
|
204
|
+
"docs",
|
|
205
|
+
"release",
|
|
206
|
+
"package"
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"orchestration": {
|
|
211
|
+
"type": "object",
|
|
212
|
+
"description": "Resolved solo-first orchestration policy captured when the task starts.",
|
|
213
|
+
"properties": {
|
|
214
|
+
"mode": {
|
|
215
|
+
"enum": [
|
|
216
|
+
"solo-first",
|
|
217
|
+
"bounded-subagents",
|
|
218
|
+
"parallel-readonly"
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
"subagents": {
|
|
222
|
+
"enum": [
|
|
223
|
+
"not-used",
|
|
224
|
+
"optional",
|
|
225
|
+
"used"
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"reason": {
|
|
229
|
+
"type": "string",
|
|
230
|
+
"minLength": 1
|
|
231
|
+
},
|
|
232
|
+
"fieldGuidePath": {
|
|
233
|
+
"type": "string",
|
|
234
|
+
"minLength": 1
|
|
235
|
+
},
|
|
236
|
+
"modelRoles": {
|
|
237
|
+
"type": "object",
|
|
238
|
+
"properties": {
|
|
239
|
+
"planner": { "type": "string" },
|
|
240
|
+
"worker": { "type": "string" },
|
|
241
|
+
"reviewer": { "type": "string" },
|
|
242
|
+
"watchdog": { "type": "string" }
|
|
243
|
+
},
|
|
244
|
+
"additionalProperties": false
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
"additionalProperties": false
|
|
248
|
+
},
|
|
249
|
+
"changedFiles": {
|
|
250
|
+
"type": "array",
|
|
251
|
+
"items": {
|
|
252
|
+
"type": "string"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"verifyEvidence": {
|
|
256
|
+
"type": "array",
|
|
257
|
+
"items": {
|
|
258
|
+
"type": "object",
|
|
259
|
+
"required": [
|
|
260
|
+
"command",
|
|
261
|
+
"exitCode",
|
|
262
|
+
"summary"
|
|
263
|
+
],
|
|
264
|
+
"properties": {
|
|
265
|
+
"command": {
|
|
266
|
+
"type": "string"
|
|
267
|
+
},
|
|
268
|
+
"exitCode": {
|
|
269
|
+
"type": "integer"
|
|
270
|
+
},
|
|
271
|
+
"summary": {
|
|
272
|
+
"type": "string"
|
|
273
|
+
},
|
|
274
|
+
"observed": {
|
|
275
|
+
"type": "boolean",
|
|
276
|
+
"description": "True only when the verify command was matched against an observed bash tool_result after task start."
|
|
277
|
+
},
|
|
278
|
+
"observedAt": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"description": "Timestamp of the matching bash tool_result observation."
|
|
281
|
+
},
|
|
282
|
+
"isError": {
|
|
283
|
+
"type": "boolean",
|
|
284
|
+
"description": "Observed Pi tool_result isError flag."
|
|
285
|
+
},
|
|
286
|
+
"matchedProfileCommand": {
|
|
287
|
+
"type": "boolean",
|
|
288
|
+
"description": "True only when the observed verify command exactly matches one of task.verifyCommands."
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
"additionalProperties": true
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"trace": {
|
|
295
|
+
"type": "object",
|
|
296
|
+
"required": [
|
|
297
|
+
"outcome"
|
|
298
|
+
],
|
|
299
|
+
"properties": {
|
|
300
|
+
"outcome": {
|
|
301
|
+
"enum": [
|
|
302
|
+
"pending",
|
|
303
|
+
"completed",
|
|
304
|
+
"blocked",
|
|
305
|
+
"partial",
|
|
306
|
+
"failed"
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
"additionalProperties": true
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"additionalProperties": true
|
|
314
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
|
|
6
|
+
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|
7
|
+
echo "Usage: scripts/audit-runtime-host.sh"
|
|
8
|
+
echo "Audit the exact Pi host and pinned optional add-ons used by the installer; requires registry access."
|
|
9
|
+
exit 0
|
|
10
|
+
fi
|
|
11
|
+
if [[ $# -gt 0 ]]; then
|
|
12
|
+
echo "Unknown argument: $1" >&2
|
|
13
|
+
exit 2
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
require_exact_peer() {
|
|
17
|
+
local name="$1"
|
|
18
|
+
local value
|
|
19
|
+
value="$(node -e 'const fs=require("node:fs"); const p=JSON.parse(fs.readFileSync(process.argv[1], "utf8")); process.stdout.write(p.peerDependencies?.[process.argv[2]] ?? "");' "$ROOT/package.json" "$name")"
|
|
20
|
+
if [[ ! "$value" =~ ^[0-9]+\.[0-9]+\.[0-9]+([+-][0-9A-Za-z.-]+)?$ ]]; then
|
|
21
|
+
echo "FAIL: peer dependency $name must use an exact version." >&2
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
printf '%s' "$value"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
PI_CODING_VERSION="$(require_exact_peer "@earendil-works/pi-coding-agent")"
|
|
28
|
+
PI_AI_VERSION="$(require_exact_peer "@earendil-works/pi-ai")"
|
|
29
|
+
TYPEBOX_VERSION="$(require_exact_peer "typebox")"
|
|
30
|
+
PI_MCP_ADAPTER_VERSION="2.11.0"
|
|
31
|
+
PI_SUBAGENTS_VERSION="0.35.1"
|
|
32
|
+
PI_WEB_ACCESS_VERSION="0.13.0"
|
|
33
|
+
|
|
34
|
+
if [[ "$PI_CODING_VERSION" != "$PI_AI_VERSION" ]]; then
|
|
35
|
+
echo "FAIL: Pi Coding Agent and Pi AI host versions must match." >&2
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
AUDIT_ROOT="$(mktemp -d "${TMPDIR:-/tmp}/piagent-runtime-audit.XXXXXX")"
|
|
40
|
+
cleanup() {
|
|
41
|
+
node --input-type=module - "$AUDIT_ROOT" <<'NODE'
|
|
42
|
+
import fs from "node:fs";
|
|
43
|
+
import os from "node:os";
|
|
44
|
+
import path from "node:path";
|
|
45
|
+
|
|
46
|
+
const target = path.resolve(process.argv[2]);
|
|
47
|
+
const tempRoot = fs.realpathSync(os.tmpdir());
|
|
48
|
+
const targetParent = fs.realpathSync(path.dirname(target));
|
|
49
|
+
if (targetParent !== tempRoot || !/^piagent-runtime-audit\.[A-Za-z0-9]+$/.test(path.basename(target))) {
|
|
50
|
+
throw new Error(`refusing to remove unexpected audit directory: ${target}`);
|
|
51
|
+
}
|
|
52
|
+
fs.rmSync(target, { recursive: true, force: true });
|
|
53
|
+
NODE
|
|
54
|
+
}
|
|
55
|
+
trap cleanup EXIT
|
|
56
|
+
|
|
57
|
+
node --input-type=module - "$AUDIT_ROOT/package.json" <<'NODE'
|
|
58
|
+
import fs from "node:fs";
|
|
59
|
+
const target = process.argv[2];
|
|
60
|
+
fs.writeFileSync(target, `${JSON.stringify({ name: "piagent-runtime-audit", version: "0.0.0", private: true }, null, 2)}\n`);
|
|
61
|
+
NODE
|
|
62
|
+
|
|
63
|
+
echo "Auditing Pi host ${PI_CODING_VERSION} and pinned add-ons at severity high and above..."
|
|
64
|
+
(
|
|
65
|
+
cd "$AUDIT_ROOT"
|
|
66
|
+
npm install --package-lock-only --ignore-scripts --no-audit --no-fund \
|
|
67
|
+
"@earendil-works/pi-coding-agent@${PI_CODING_VERSION}" \
|
|
68
|
+
"@earendil-works/pi-ai@${PI_AI_VERSION}" \
|
|
69
|
+
"typebox@${TYPEBOX_VERSION}" \
|
|
70
|
+
"pi-mcp-adapter@${PI_MCP_ADAPTER_VERSION}" \
|
|
71
|
+
"pi-subagents@${PI_SUBAGENTS_VERSION}" \
|
|
72
|
+
"pi-web-access@${PI_WEB_ACCESS_VERSION}" >/dev/null
|
|
73
|
+
# npm audit exits non-zero when it finds anything, so its status says nothing
|
|
74
|
+
# about whether the finding is one this project has accepted. The policy check
|
|
75
|
+
# decides that, and its exit status is the one that counts.
|
|
76
|
+
npm audit --json > audit.json || true
|
|
77
|
+
node "$ROOT/scripts/check-runtime-advisories.mjs" < audit.json
|
|
78
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
PLATFORM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
PI_AGENT_DIR="${PI_CODING_AGENT_DIR:-"${HOME}/.pi/agent"}"
|
|
6
|
+
MCP_CONFIG_DIR="${XDG_CONFIG_HOME:-"${HOME}/.config"}/mcp"
|
|
7
|
+
|
|
8
|
+
mkdir -p "$PI_AGENT_DIR/extensions" "$PI_AGENT_DIR/prompts" "$PI_AGENT_DIR/skills"
|
|
9
|
+
mkdir -p "$MCP_CONFIG_DIR"
|
|
10
|
+
|
|
11
|
+
echo "Pi Agent Platform"
|
|
12
|
+
echo "platform: $PLATFORM_ROOT"
|
|
13
|
+
echo "pi agent dir: $PI_AGENT_DIR"
|
|
14
|
+
echo
|
|
15
|
+
echo "Run these commands when ready:"
|
|
16
|
+
echo
|
|
17
|
+
echo " bash \"$PLATFORM_ROOT/scripts/install-global.sh\" --package-source \"$PLATFORM_ROOT\" --with-mcp --mcp-preset core --with-herdr"
|
|
18
|
+
echo " pi"
|
|
19
|
+
echo " /login"
|
|
20
|
+
echo
|
|
21
|
+
echo "Then link a project:"
|
|
22
|
+
echo
|
|
23
|
+
echo " bash \"$PLATFORM_ROOT/scripts/init-project.sh\" /path/to/project --profile generic --package-source git:github.com/Vt-mmm/piagent@vX.Y.Z"
|
|
24
|
+
echo " cd /path/to/project"
|
|
25
|
+
echo " pi"
|