@piagent/platform 1.2.12 → 1.2.14

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 (70) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +17 -3
  3. package/README.vi.md +90 -0
  4. package/architecture/layers.json +117 -0
  5. package/docs/README.md +23 -0
  6. package/docs/architecture.md +7 -61
  7. package/docs/command-reference-vietnamese.md +6 -6
  8. package/docs/distribution-standard.md +7 -7
  9. package/docs/en/README.md +13 -0
  10. package/docs/en/architecture.md +81 -0
  11. package/docs/en/maintainer-guide.md +121 -0
  12. package/docs/languages.json +40 -0
  13. package/docs/operator-manual-vietnamese.md +7 -7
  14. package/docs/package-architecture-notes.md +9 -0
  15. package/docs/quality-benchmark.md +93 -0
  16. package/docs/release-install-policy.md +6 -6
  17. package/docs/security-threat-model.md +1 -1
  18. package/docs/team-onboarding.md +2 -2
  19. package/docs/vi/README.md +13 -0
  20. package/docs/vi/architecture.md +81 -0
  21. package/docs/vi/maintainer-guide.md +121 -0
  22. package/docs-site/architecture.html +39 -14
  23. package/docs-site/assets/docs.css +407 -0
  24. package/docs-site/benchmark.html +341 -0
  25. package/docs-site/commands.html +4 -1
  26. package/docs-site/content/architecture.html +35 -13
  27. package/docs-site/content/benchmark.html +214 -0
  28. package/docs-site/content/index.html +5 -0
  29. package/docs-site/context-engine.html +6 -3
  30. package/docs-site/index.html +9 -1
  31. package/docs-site/mcp-approval.html +4 -1
  32. package/docs-site/mcp-auth.html +4 -1
  33. package/docs-site/mcp-servers.html +4 -1
  34. package/docs-site/mcp.html +4 -1
  35. package/docs-site/permissions.html +4 -1
  36. package/docs-site/profiles.html +4 -1
  37. package/docs-site/quickstart.html +4 -1
  38. package/docs-site/runtime.html +6 -3
  39. package/docs-site/scope.html +4 -1
  40. package/docs-site/security.html +4 -1
  41. package/docs-site/team.html +4 -1
  42. package/docs-site/workflows.html +4 -1
  43. package/package.json +5 -1
  44. package/packages/piagent-core/README.md +6 -2
  45. package/packages/piagent-core/capabilities/capability-core.js +3 -0
  46. package/packages/piagent-core/capabilities/runtime-integrity.js +18 -0
  47. package/packages/piagent-core/extensions/guard-types.ts +0 -37
  48. package/packages/piagent-core/extensions/piagent-guard.ts +170 -2099
  49. package/packages/piagent-core/extensions/task-state.js +22 -3
  50. package/packages/piagent-core/package.json +1 -1
  51. package/packages/piagent-core/runtime/hooks/agent-start-hook.ts +213 -0
  52. package/packages/piagent-core/runtime/hooks/completion-hook.ts +203 -0
  53. package/packages/piagent-core/runtime/hooks/input-hook.ts +122 -0
  54. package/packages/piagent-core/runtime/hooks/session-hooks.ts +104 -0
  55. package/packages/piagent-core/runtime/hooks/session-start-hook.ts +140 -0
  56. package/packages/piagent-core/runtime/hooks/tool-result-hook.ts +316 -0
  57. package/packages/piagent-core/runtime/input/chat-images.ts +299 -0
  58. package/packages/piagent-core/runtime/runtime-limits.ts +21 -0
  59. package/packages/piagent-core/runtime/session/message-signals.ts +64 -0
  60. package/packages/piagent-core/runtime/session/runtime-state.ts +175 -0
  61. package/packages/piagent-core/runtime/session/system-prompt.ts +52 -0
  62. package/packages/piagent-core/runtime/session/tool-result-compaction.ts +352 -0
  63. package/packages/piagent-core/runtime/session/usage.ts +178 -0
  64. package/packages/piagent-core/runtime/tools/tool-groups.ts +86 -0
  65. package/packages/piagent-core/runtime/workflows/input-routing.ts +113 -0
  66. package/packages/piagent-core/runtime/workflows/task-intake.ts +73 -0
  67. package/scripts/build-docs-site.mjs +10 -1
  68. package/scripts/check-architecture.mjs +132 -0
  69. package/scripts/check-doc-languages.mjs +67 -0
  70. package/scripts/verify-local.sh +31 -0
@@ -27,7 +27,8 @@
27
27
  <span>Pi Agent Platform</span>
28
28
  </a>
29
29
  <div class="top-actions">
30
- <span class="pill"><span class="pill-dot"></span>v1.2.12 docs</span>
30
+ <span class="pill"><span class="pill-dot"></span>v1.2.14 docs · VI</span>
31
+ <a class="button" href="https://github.com/Vt-mmm/piagent/blob/main/docs/en/README.md" lang="en" target="_blank" rel="noopener noreferrer">English docs</a>
31
32
  <a class="button social" href="https://github.com/Vt-mmm/piagent" target="_blank" rel="noopener noreferrer" aria-label="Mở GitHub repository">
32
33
  <svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
33
34
  <path d="M7 17 17 7M9 7h8v8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
@@ -74,6 +75,7 @@
74
75
  <a class="nav-link" href="/security">Security model</a>
75
76
  <a class="nav-link" href="/architecture">Architecture</a>
76
77
  <a class="nav-link" href="/context-engine">Context Engine</a>
78
+ <a class="nav-link" href="/benchmark">Benchmark</a>
77
79
  <a class="nav-link" href="/runtime">Runtime tools</a>
78
80
  <a class="nav-link current" href="/team" aria-current="page">Team usage</a>
79
81
  </div>
@@ -128,6 +130,7 @@
128
130
  <div class="footer-links" aria-label="External links">
129
131
  <a href="https://piagent.io.vn" target="_blank" rel="noopener noreferrer">piagent.io.vn</a>
130
132
  <a href="https://github.com/Vt-mmm/piagent" target="_blank" rel="noopener noreferrer">GitHub repository</a>
133
+ <a href="https://github.com/Vt-mmm/piagent/blob/main/docs/en/README.md" lang="en" target="_blank" rel="noopener noreferrer">English docs</a>
131
134
  <a href="https://www.facebook.com/vinhtam0544/" target="_blank" rel="noopener noreferrer">Facebook profile</a>
132
135
  </div>
133
136
  </footer>
@@ -27,7 +27,8 @@
27
27
  <span>Pi Agent Platform</span>
28
28
  </a>
29
29
  <div class="top-actions">
30
- <span class="pill"><span class="pill-dot"></span>v1.2.12 docs</span>
30
+ <span class="pill"><span class="pill-dot"></span>v1.2.14 docs · VI</span>
31
+ <a class="button" href="https://github.com/Vt-mmm/piagent/blob/main/docs/en/README.md" lang="en" target="_blank" rel="noopener noreferrer">English docs</a>
31
32
  <a class="button social" href="https://github.com/Vt-mmm/piagent" target="_blank" rel="noopener noreferrer" aria-label="Mở GitHub repository">
32
33
  <svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
33
34
  <path d="M7 17 17 7M9 7h8v8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
@@ -74,6 +75,7 @@
74
75
  <a class="nav-link" href="/security">Security model</a>
75
76
  <a class="nav-link" href="/architecture">Architecture</a>
76
77
  <a class="nav-link" href="/context-engine">Context Engine</a>
78
+ <a class="nav-link" href="/benchmark">Benchmark</a>
77
79
  <a class="nav-link" href="/runtime">Runtime tools</a>
78
80
  <a class="nav-link" href="/team">Team usage</a>
79
81
  </div>
@@ -156,6 +158,7 @@
156
158
  <div class="footer-links" aria-label="External links">
157
159
  <a href="https://piagent.io.vn" target="_blank" rel="noopener noreferrer">piagent.io.vn</a>
158
160
  <a href="https://github.com/Vt-mmm/piagent" target="_blank" rel="noopener noreferrer">GitHub repository</a>
161
+ <a href="https://github.com/Vt-mmm/piagent/blob/main/docs/en/README.md" lang="en" target="_blank" rel="noopener noreferrer">English docs</a>
159
162
  <a href="https://www.facebook.com/vinhtam0544/" target="_blank" rel="noopener noreferrer">Facebook profile</a>
160
163
  </div>
161
164
  </footer>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piagent/platform",
3
- "version": "1.2.12",
3
+ "version": "1.2.14",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -27,7 +27,9 @@
27
27
  "CONTRIBUTING.md",
28
28
  "LICENSE",
29
29
  "README.md",
30
+ "README.vi.md",
30
31
  "SECURITY.md",
32
+ "architecture/",
31
33
  ".gitattributes",
32
34
  "adapters/",
33
35
  "benchmarks/",
@@ -122,6 +124,8 @@
122
124
  "site:build": "node scripts/build-docs-site.mjs",
123
125
  "site:preview": "node scripts/preview-docs-site.mjs",
124
126
  "site:check": "node scripts/check-published-site.mjs",
127
+ "architecture:check": "node scripts/check-architecture.mjs",
128
+ "docs:check": "node scripts/check-doc-languages.mjs",
125
129
  "smoke": "bash scripts/runtime-policy-smoke.sh",
126
130
  "usage": "bash scripts/pi-session-stats.sh",
127
131
  "auto": "bash scripts/pi-auto.sh",
@@ -4,7 +4,9 @@ Shared Pi package for reusable project workflows.
4
4
 
5
5
  ## Contents
6
6
 
7
- - `extensions/piagent-guard.ts`: runtime guard tools and policy hooks.
7
+ - `extensions/piagent-guard.ts`: Pi extension composition root and registration order.
8
+ - `runtime/`: Pi-facing session, usage, log-compaction, and workflow input adapters. New command/tool/hook modules belong here.
9
+ - `extensions/*.js|ts`: legacy-location core services for policy, context, task lifecycle, state, and document intake; only `piagent-guard.ts` is loaded as an extension.
8
10
  - `prompts/*.md`: workflow aliases that intentionally launch an agent turn.
9
11
  - `skills/piagent-ops/SKILL.md`: operator-invoked reference for manual intake, recovery, and high-risk controls; routine runtime-managed tasks do not advertise or load it.
10
12
  - `skills/piagent-source-cache/`: local cache for user-provided external source repositories.
@@ -15,6 +17,8 @@ Shared Pi package for reusable project workflows.
15
17
  - compact tool-result rendering: oversized redacted output is previewed in Pi and captured under `.pi/piagent-state/tool-results/` for offline audit/reporting.
16
18
  - local Context Engine v2: incremental FTS5/symbol/import index, hybrid retrieval, token-budgeted packs, bounded current-turn source/test snapshots, test-impact mapping, dynamic Piagent tools, and Agent Watch compatible telemetry.
17
19
 
20
+ Architecture boundaries and non-growth file budgets are enforced by `npm run architecture:check`. See [English architecture](../../docs/en/architecture.md), [kiến trúc tiếng Việt](../../docs/vi/architecture.md), and the paired maintainer guides before adding a new runtime surface.
21
+
18
22
  The root package exposes `piagent-benchmark` for an automatic paired Piagent
19
23
  steady-state benchmark against Raw Pi or the `codex-cli` surface. Treatment
20
24
  onboarding/context preparation happens before measured model usage;
@@ -99,7 +103,7 @@ groups load only when requested.
99
103
  - `/commands`: runtime menu/help for terminal, Pi, MCP, model, memory, session, context, permission, and subagent commands.
100
104
  - `/workflow`: one launcher for task, scout, BE-to-FE, discuss, plan, review, commit, PR, platform-improve, and onboarding workflows.
101
105
  - `/usage`: runtime usage namespace for live snapshot, history hint, preflight, compact, compact-log captures, and context efficiency.
102
- - `/name`: set the current session name for Agent Watch/report mapping.
106
+ - Pi native `/name`: set the current session name for Agent Watch/report mapping; Piagent observes the native rename event and keeps `/setname` as a compatibility alias.
103
107
  - `/fresh`: open a fresh governed session for `task`, `scout`, or `be-to-fe`.
104
108
  - `/context`: runtime context namespace for index/rebuild/search/pack/test-impact/efficiency, task preflight, and semantic compact.
105
109
  - `/permission`: runtime permission namespace for status/read-only/workspace-write/full-access.
@@ -3,6 +3,7 @@ import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { containsSensitiveText } from "../security/sensitive-data.js";
5
5
  import { resolveProjectProfileDocument } from "./project-profile.js";
6
+ import { CORE_RUNTIME_INTEGRITY_FILES } from "./runtime-integrity.js";
6
7
 
7
8
  const API_VERSION = "piagent/v1";
8
9
  const CORE_API_VERSION = 1;
@@ -788,6 +789,7 @@ function buildCoreIntegrity(root) {
788
789
  "packages/piagent-core/package.json",
789
790
  "packages/piagent-core/policies/base-policy.json",
790
791
  "packages/piagent-core/capabilities/capability-core.js",
792
+ "packages/piagent-core/capabilities/runtime-integrity.js",
791
793
  // capability-sources.js decides which external trees become readable packs,
792
794
  // so tampering with it changes which code the profile can grant.
793
795
  "packages/piagent-core/capabilities/capability-sources.js",
@@ -796,6 +798,7 @@ function buildCoreIntegrity(root) {
796
798
  "packages/piagent-core/capabilities/project-profile.js",
797
799
  "packages/piagent-core/security/sensitive-data.js",
798
800
  "packages/piagent-core/extensions/piagent-guard.ts",
801
+ ...CORE_RUNTIME_INTEGRITY_FILES,
799
802
  // context-engine.js decides which repository content enters the model
800
803
  // context and records the resulting telemetry, so it is part of the
801
804
  // runtime trust boundary enforced by the profile lock.
@@ -0,0 +1,18 @@
1
+ export const CORE_RUNTIME_INTEGRITY_FILES = Object.freeze([
2
+ "packages/piagent-core/runtime/hooks/agent-start-hook.ts",
3
+ "packages/piagent-core/runtime/hooks/completion-hook.ts",
4
+ "packages/piagent-core/runtime/hooks/input-hook.ts",
5
+ "packages/piagent-core/runtime/hooks/session-hooks.ts",
6
+ "packages/piagent-core/runtime/hooks/session-start-hook.ts",
7
+ "packages/piagent-core/runtime/hooks/tool-result-hook.ts",
8
+ "packages/piagent-core/runtime/input/chat-images.ts",
9
+ "packages/piagent-core/runtime/runtime-limits.ts",
10
+ "packages/piagent-core/runtime/session/message-signals.ts",
11
+ "packages/piagent-core/runtime/session/runtime-state.ts",
12
+ "packages/piagent-core/runtime/session/system-prompt.ts",
13
+ "packages/piagent-core/runtime/session/tool-result-compaction.ts",
14
+ "packages/piagent-core/runtime/session/usage.ts",
15
+ "packages/piagent-core/runtime/tools/tool-groups.ts",
16
+ "packages/piagent-core/runtime/workflows/input-routing.ts",
17
+ "packages/piagent-core/runtime/workflows/task-intake.ts"
18
+ ]);
@@ -391,43 +391,6 @@ export type EffectiveProtectedPaths = {
391
391
  readOnlyPaths: string[];
392
392
  };
393
393
 
394
- export type UsageSnapshot = {
395
- sessionFile?: string;
396
- sessionId?: string;
397
- sessionName?: string;
398
- cwd: string;
399
- mode: string;
400
- model: string;
401
- thinkingLevel: string;
402
- entries: {
403
- total: number;
404
- branch: number;
405
- };
406
- contextUsage?: {
407
- tokens: number | null;
408
- contextWindow: number;
409
- percent: number | null;
410
- };
411
- exactTotals: {
412
- availableInCommand: false;
413
- howToRead: string[];
414
- };
415
- };
416
-
417
- export type ContextPreflight = {
418
- workflow: string;
419
- inputChars: number;
420
- inputTokenEstimate: number;
421
- liveContext?: UsageSnapshot["contextUsage"];
422
- projectedContext?: {
423
- tokens: number;
424
- percent: number;
425
- };
426
- recommendation: "ok" | "watch" | "compact" | "fresh-session" | "unknown";
427
- reason: string;
428
- commands: string[];
429
- };
430
-
431
394
  export type ReferenceRepo = {
432
395
  host: string;
433
396
  owner: string;