@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.
Files changed (159) hide show
  1. package/.gitattributes +7 -0
  2. package/AGENTS.md +31 -0
  3. package/CHANGELOG.md +296 -0
  4. package/CODE_OF_CONDUCT.md +36 -0
  5. package/CONTRIBUTING.md +66 -0
  6. package/LICENSE +21 -0
  7. package/README.md +588 -0
  8. package/SECURITY.md +38 -0
  9. package/adapters/backend-api/profile.json +88 -0
  10. package/adapters/be-readonly-fe/profile.json +120 -0
  11. package/adapters/data/profile.json +88 -0
  12. package/adapters/devops/profile.json +92 -0
  13. package/adapters/docs/profile.json +74 -0
  14. package/adapters/fullstack/profile.json +94 -0
  15. package/adapters/generic/profile.json +95 -0
  16. package/adapters/mobile/profile.json +87 -0
  17. package/adapters/node-typescript/profile.json +76 -0
  18. package/adapters/python/profile.json +75 -0
  19. package/adapters/web-frontend/profile.json +101 -0
  20. package/catalog/capabilities.json +206 -0
  21. package/docs/architecture.md +64 -0
  22. package/docs/auto-delegation-policy.md +192 -0
  23. package/docs/capability-packs.md +234 -0
  24. package/docs/command-reference-vietnamese.md +484 -0
  25. package/docs/context-window-policy.md +85 -0
  26. package/docs/distribution-standard.md +229 -0
  27. package/docs/herdr-workflow.md +58 -0
  28. package/docs/mcp-and-tools.md +316 -0
  29. package/docs/memory-policy.md +164 -0
  30. package/docs/model-options.md +165 -0
  31. package/docs/oauth-providers.md +53 -0
  32. package/docs/operator-manual-vietnamese.md +1080 -0
  33. package/docs/package-architecture-notes.md +101 -0
  34. package/docs/project-adapters.md +174 -0
  35. package/docs/project-onboarding.md +135 -0
  36. package/docs/publishing-for-teams.md +64 -0
  37. package/docs/quality-benchmark.md +74 -0
  38. package/docs/quickstart-vietnamese.md +350 -0
  39. package/docs/release-install-policy.md +223 -0
  40. package/docs/runtime-harness-standard.md +118 -0
  41. package/docs/runtime-policy-design.md +132 -0
  42. package/docs/runtime-quality-baseline.md +257 -0
  43. package/docs/security-redaction-benchmark.md +56 -0
  44. package/docs/security-threat-model.md +66 -0
  45. package/docs/subagent-orchestration-capabilities.md +104 -0
  46. package/docs/subagents-and-multiagent.md +346 -0
  47. package/docs/task-implementation-contract.md +200 -0
  48. package/docs/team-onboarding.md +333 -0
  49. package/docs/usage-observability.md +130 -0
  50. package/docs/vercel-docs-site.md +115 -0
  51. package/docs/workflow-recipes.md +125 -0
  52. package/docs-site/assets/piagent-logo.svg +35 -0
  53. package/docs-site/favicon.svg +18 -0
  54. package/docs-site/index.html +1613 -0
  55. package/docs-site/vercel.json +24 -0
  56. package/evals/fixtures/action-proposal.invalid.json +34 -0
  57. package/evals/fixtures/action-proposal.valid.json +34 -0
  58. package/evals/fixtures/capability-pack.invalid.json +123 -0
  59. package/evals/fixtures/capability-pack.valid.json +123 -0
  60. package/evals/fixtures/capability-recipe.invalid.json +81 -0
  61. package/evals/fixtures/capability-recipe.valid.json +82 -0
  62. package/evals/fixtures/context-index.invalid.json +25 -0
  63. package/evals/fixtures/context-index.valid.json +25 -0
  64. package/evals/fixtures/eval-scenario.invalid.json +40 -0
  65. package/evals/fixtures/eval-scenario.valid.json +45 -0
  66. package/evals/fixtures/project-profile.invalid.json +88 -0
  67. package/evals/fixtures/project-profile.valid.json +95 -0
  68. package/evals/fixtures/task-contract.invalid.json +73 -0
  69. package/evals/fixtures/task-contract.valid.json +74 -0
  70. package/evals/golden/enforcement-decisions.json +329 -0
  71. package/evals/scenarios/capability-resolution.json +45 -0
  72. package/package.json +132 -0
  73. package/packages/piagent-core/README.md +147 -0
  74. package/packages/piagent-core/capabilities/capability-core.js +1023 -0
  75. package/packages/piagent-core/capabilities/capability-sources.js +265 -0
  76. package/packages/piagent-core/extensions/guard-io.js +45 -0
  77. package/packages/piagent-core/extensions/guard-shell-analysis.ts +558 -0
  78. package/packages/piagent-core/extensions/guard-types.ts +406 -0
  79. package/packages/piagent-core/extensions/piagent-guard.ts +5760 -0
  80. package/packages/piagent-core/extensions/policy-core.js +1070 -0
  81. package/packages/piagent-core/extensions/redaction-core.js +4 -0
  82. package/packages/piagent-core/extensions/runtime-evidence.js +215 -0
  83. package/packages/piagent-core/package.json +46 -0
  84. package/packages/piagent-core/policies/base-policy.json +249 -0
  85. package/packages/piagent-core/prompts/be-to-fe.md +82 -0
  86. package/packages/piagent-core/prompts/commit.md +27 -0
  87. package/packages/piagent-core/prompts/discuss.md +35 -0
  88. package/packages/piagent-core/prompts/memory-policy.md +52 -0
  89. package/packages/piagent-core/prompts/model-options.md +68 -0
  90. package/packages/piagent-core/prompts/onboard-project.md +147 -0
  91. package/packages/piagent-core/prompts/piagent-commands.md +68 -0
  92. package/packages/piagent-core/prompts/plan.md +35 -0
  93. package/packages/piagent-core/prompts/platform-improve.md +69 -0
  94. package/packages/piagent-core/prompts/pr.md +26 -0
  95. package/packages/piagent-core/prompts/review.md +38 -0
  96. package/packages/piagent-core/prompts/scout.md +50 -0
  97. package/packages/piagent-core/prompts/task.md +69 -0
  98. package/packages/piagent-core/security/sensitive-data.js +187 -0
  99. package/packages/piagent-core/skills/piagent-ops/SKILL.md +44 -0
  100. package/packages/piagent-core/skills/piagent-source-cache/SKILL.md +59 -0
  101. package/packages/piagent-core/skills/piagent-source-cache/checkout-source-repo.sh +144 -0
  102. package/packages/piagent-core/subagents/piagent-oracle.md +29 -0
  103. package/packages/piagent-core/subagents/piagent-planner.md +46 -0
  104. package/packages/piagent-core/subagents/piagent-reviewer.md +48 -0
  105. package/packages/piagent-core/subagents/piagent-scout.md +37 -0
  106. package/packages/piagent-core/subagents/piagent-worker.md +44 -0
  107. package/packs/engineering-base/pack.json +123 -0
  108. package/packs/engineering-base/recipes/bounded-change.json +82 -0
  109. package/packs/web-delivery/pack.json +72 -0
  110. package/packs/web-delivery/recipes/verified-web-change.json +57 -0
  111. package/schemas/action-proposal.schema.json +90 -0
  112. package/schemas/capability-pack.schema.json +190 -0
  113. package/schemas/capability-recipe.schema.json +72 -0
  114. package/schemas/context-index.schema.json +258 -0
  115. package/schemas/eval-scenario.schema.json +67 -0
  116. package/schemas/project-profile.schema.json +555 -0
  117. package/schemas/task-contract.schema.json +314 -0
  118. package/scripts/audit-runtime-host.sh +78 -0
  119. package/scripts/bootstrap-local.sh +25 -0
  120. package/scripts/capability-catalog.mjs +290 -0
  121. package/scripts/check-runtime-advisories.mjs +114 -0
  122. package/scripts/configure-mcp.sh +301 -0
  123. package/scripts/configure-model-scope.sh +143 -0
  124. package/scripts/configure-subagents.sh +241 -0
  125. package/scripts/import-agent-instructions.mjs +199 -0
  126. package/scripts/init-project.sh +369 -0
  127. package/scripts/install-global.sh +532 -0
  128. package/scripts/link-project.sh +25 -0
  129. package/scripts/migrate-project-state.mjs +176 -0
  130. package/scripts/pi-auto.sh +79 -0
  131. package/scripts/pi-model-catalog.sh +154 -0
  132. package/scripts/pi-session-stats.sh +135 -0
  133. package/scripts/piagent-cli.mjs +53 -0
  134. package/scripts/profile-doctor.sh +238 -0
  135. package/scripts/quality-benchmark.sh +185 -0
  136. package/scripts/redaction-benchmark.mjs +227 -0
  137. package/scripts/runtime-policy-smoke.sh +48 -0
  138. package/scripts/setup.sh +425 -0
  139. package/scripts/team-doctor.sh +461 -0
  140. package/scripts/verify-local.sh +540 -0
  141. package/scripts/verify-release-identity.mjs +85 -0
  142. package/scripts/verify-vercel-link.mjs +64 -0
  143. package/templates/global/mcp.json +9 -0
  144. package/templates/global/settings.json +37 -0
  145. package/templates/project/.mcp.json +9 -0
  146. package/templates/project/.pi/context-index.json +25 -0
  147. package/templates/project/.pi/gitignore.template +22 -0
  148. package/templates/project/.pi/mcp.json +9 -0
  149. package/templates/project/.pi/memory/MEMORY.md +11 -0
  150. package/templates/project/.pi/memory/memory_summary.md +9 -0
  151. package/templates/project/.pi/piagent-profile.json +107 -0
  152. package/templates/project/.pi/project-context.md +30 -0
  153. package/templates/project/.pi/settings.json +17 -0
  154. package/templates/project/.pi/task-contract.template.json +74 -0
  155. package/templates/project/.pi/tech-context/README.md +7 -0
  156. package/templates/project/.pi/tech-stack.json +10 -0
  157. package/templates/project/AGENTS.md +34 -0
  158. package/templates/project/REVIEW_GUIDELINES.md +23 -0
  159. package/types/pi-runtime-shims.d.ts +13 -0
@@ -0,0 +1,123 @@
1
+ {
2
+ "apiVersion": "piagent/v1",
3
+ "kind": "CapabilityPack",
4
+ "metadata": {
5
+ "name": "engineering-base",
6
+ "version": "0.1.1",
7
+ "owner": "platform-maintainers",
8
+ "lifecycle": "experimental",
9
+ "license": "MIT",
10
+ "description": "Core engineering workflow, policy, verification, and task coordination capabilities.",
11
+ "tags": [
12
+ "engineering",
13
+ "governance"
14
+ ]
15
+ },
16
+ "spec": {
17
+ "coreApiVersion": 1,
18
+ "requires": {
19
+ "packs": []
20
+ },
21
+ "provides": {
22
+ "prompts": [
23
+ {
24
+ "id": "task",
25
+ "path": "packages/piagent-core/prompts/task.md"
26
+ },
27
+ {
28
+ "id": "plan",
29
+ "path": "packages/piagent-core/prompts/plan.md"
30
+ },
31
+ {
32
+ "id": "review",
33
+ "path": "packages/piagent-core/prompts/review.md"
34
+ },
35
+ {
36
+ "id": "commit",
37
+ "path": "packages/piagent-core/prompts/commit.md"
38
+ },
39
+ {
40
+ "id": "pr",
41
+ "path": "packages/piagent-core/prompts/pr.md"
42
+ }
43
+ ],
44
+ "skills": [
45
+ {
46
+ "id": "piagent-ops",
47
+ "path": "packages/piagent-core/skills/piagent-ops/SKILL.md"
48
+ }
49
+ ],
50
+ "subagents": [
51
+ {
52
+ "id": "piagent-scout",
53
+ "path": "packages/piagent-core/subagents/piagent-scout.md"
54
+ },
55
+ {
56
+ "id": "piagent-planner",
57
+ "path": "packages/piagent-core/subagents/piagent-planner.md"
58
+ },
59
+ {
60
+ "id": "piagent-worker",
61
+ "path": "packages/piagent-core/subagents/piagent-worker.md"
62
+ },
63
+ {
64
+ "id": "piagent-reviewer",
65
+ "path": "packages/piagent-core/subagents/piagent-reviewer.md"
66
+ }
67
+ ],
68
+ "policies": [
69
+ {
70
+ "id": "base-policy",
71
+ "path": "packages/piagent-core/policies/base-policy.json"
72
+ }
73
+ ],
74
+ "adapters": [
75
+ {
76
+ "id": "generic",
77
+ "path": "adapters/generic/profile.json"
78
+ }
79
+ ],
80
+ "recipes": [
81
+ {
82
+ "id": "bounded-change",
83
+ "path": "packs/engineering-base/recipes/bounded-change.json"
84
+ }
85
+ ],
86
+ "evals": [
87
+ {
88
+ "id": "capability-resolution",
89
+ "path": "evals/scenarios/capability-resolution.json"
90
+ }
91
+ ]
92
+ },
93
+ "permissions": {
94
+ "capabilities": [
95
+ "filesystem-readonly",
96
+ "filesystem-write",
97
+ "memory",
98
+ "shell"
99
+ ],
100
+ "filesystemRead": [
101
+ "**/*"
102
+ ],
103
+ "filesystemWrite": [
104
+ "**/*"
105
+ ],
106
+ "networkDomains": [],
107
+ "externalActions": []
108
+ },
109
+ "activation": {
110
+ "mode": "profile",
111
+ "profiles": [
112
+ "generic",
113
+ "platform-development"
114
+ ],
115
+ "triggers": []
116
+ },
117
+ "verification": {
118
+ "evalScenarios": [
119
+ "capability-resolution"
120
+ ]
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "apiVersion": "piagent/v1",
3
+ "kind": "CapabilityRecipe",
4
+ "metadata": {
5
+ "name": "bounded-change",
6
+ "version": "0.1.0",
7
+ "owner": "platform-maintainers",
8
+ "lifecycle": "experimental",
9
+ "license": "MIT",
10
+ "description": "A governed workflow for a bounded repository change with observed verification.",
11
+ "tags": [
12
+ "engineering",
13
+ "verification"
14
+ ]
15
+ },
16
+ "spec": {
17
+ "inputs": [
18
+ {
19
+ "name": "task",
20
+ "description": "Expected outcome and acceptance criteria.",
21
+ "required": true
22
+ }
23
+ ],
24
+ "steps": [
25
+ {
26
+ "id": "context",
27
+ "uses": "capability:piagent-context",
28
+ "mode": "read-only",
29
+ "needs": [],
30
+ "timeoutSeconds": 300,
31
+ "retries": 0,
32
+ "outputs": [
33
+ "context-manifest"
34
+ ]
35
+ },
36
+ {
37
+ "id": "plan",
38
+ "uses": "capability:piagent-planner",
39
+ "mode": "read-only",
40
+ "needs": [
41
+ "context"
42
+ ],
43
+ "timeoutSeconds": 600,
44
+ "retries": 0,
45
+ "outputs": [
46
+ "implementation-plan"
47
+ ]
48
+ },
49
+ {
50
+ "id": "implement",
51
+ "uses": "capability:piagent-worker",
52
+ "mode": "workspace-write",
53
+ "needs": [
54
+ "plan"
55
+ ],
56
+ "timeoutSeconds": 1800,
57
+ "retries": 1,
58
+ "outputs": [
59
+ "workspace-diff"
60
+ ]
61
+ },
62
+ {
63
+ "id": "verify",
64
+ "uses": "capability:piagent-reviewer",
65
+ "mode": "read-only",
66
+ "needs": [
67
+ "implement"
68
+ ],
69
+ "timeoutSeconds": 900,
70
+ "retries": 1,
71
+ "outputs": [
72
+ "verification-evidence"
73
+ ]
74
+ }
75
+ ],
76
+ "gates": {
77
+ "context": true,
78
+ "verification": true,
79
+ "humanApproval": false
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "apiVersion": "piagent/v1",
3
+ "kind": "CapabilityPack",
4
+ "metadata": {
5
+ "name": "web-delivery",
6
+ "version": "0.1.1",
7
+ "owner": "platform-maintainers",
8
+ "lifecycle": "experimental",
9
+ "license": "MIT",
10
+ "description": "Web application delivery capabilities with browser-assisted verification.",
11
+ "tags": [
12
+ "frontend",
13
+ "web"
14
+ ]
15
+ },
16
+ "spec": {
17
+ "coreApiVersion": 1,
18
+ "requires": {
19
+ "packs": [
20
+ {
21
+ "name": "engineering-base",
22
+ "version": "0.1.1"
23
+ }
24
+ ]
25
+ },
26
+ "provides": {
27
+ "prompts": [],
28
+ "skills": [],
29
+ "subagents": [],
30
+ "policies": [],
31
+ "adapters": [
32
+ {
33
+ "id": "web-frontend",
34
+ "path": "adapters/web-frontend/profile.json"
35
+ }
36
+ ],
37
+ "recipes": [
38
+ {
39
+ "id": "verified-web-change",
40
+ "path": "packs/web-delivery/recipes/verified-web-change.json"
41
+ }
42
+ ],
43
+ "evals": []
44
+ },
45
+ "permissions": {
46
+ "capabilities": [
47
+ "browser",
48
+ "filesystem-readonly",
49
+ "filesystem-write",
50
+ "shell"
51
+ ],
52
+ "filesystemRead": [
53
+ "**/*"
54
+ ],
55
+ "filesystemWrite": [
56
+ "**/*"
57
+ ],
58
+ "networkDomains": [],
59
+ "externalActions": []
60
+ },
61
+ "activation": {
62
+ "mode": "profile",
63
+ "profiles": [
64
+ "web-frontend"
65
+ ],
66
+ "triggers": []
67
+ },
68
+ "verification": {
69
+ "evalScenarios": []
70
+ }
71
+ }
72
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "apiVersion": "piagent/v1",
3
+ "kind": "CapabilityRecipe",
4
+ "metadata": {
5
+ "name": "verified-web-change",
6
+ "version": "0.1.0",
7
+ "owner": "platform-maintainers",
8
+ "lifecycle": "experimental",
9
+ "license": "MIT",
10
+ "description": "A web change workflow with source verification and bounded browser inspection.",
11
+ "tags": [
12
+ "frontend",
13
+ "verification"
14
+ ]
15
+ },
16
+ "spec": {
17
+ "inputs": [
18
+ {
19
+ "name": "task",
20
+ "description": "Expected interface behavior and acceptance criteria.",
21
+ "required": true
22
+ }
23
+ ],
24
+ "steps": [
25
+ {
26
+ "id": "context",
27
+ "uses": "recipe:bounded-change",
28
+ "mode": "workspace-write",
29
+ "needs": [],
30
+ "timeoutSeconds": 2400,
31
+ "retries": 0,
32
+ "outputs": [
33
+ "workspace-diff",
34
+ "verification-evidence"
35
+ ]
36
+ },
37
+ {
38
+ "id": "browser-check",
39
+ "uses": "capability:browser-inspection",
40
+ "mode": "read-only",
41
+ "needs": [
42
+ "context"
43
+ ],
44
+ "timeoutSeconds": 900,
45
+ "retries": 1,
46
+ "outputs": [
47
+ "runtime-evidence"
48
+ ]
49
+ }
50
+ ],
51
+ "gates": {
52
+ "context": true,
53
+ "verification": true,
54
+ "humanApproval": false
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,90 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/Vt-mmm/piagent/schemas/action-proposal.schema.json",
4
+ "title": "Pi Agent External Action Proposal",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["apiVersion", "kind", "metadata", "spec"],
8
+ "properties": {
9
+ "apiVersion": { "const": "piagent/v1" },
10
+ "kind": { "const": "ExternalActionProposal" },
11
+ "metadata": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "required": ["name", "createdAt", "expiresAt"],
15
+ "properties": {
16
+ "name": { "$ref": "capability-pack.schema.json#/$defs/name" },
17
+ "createdAt": {
18
+ "type": "string",
19
+ "format": "date-time",
20
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
21
+ },
22
+ "expiresAt": {
23
+ "type": "string",
24
+ "format": "date-time",
25
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
26
+ }
27
+ }
28
+ },
29
+ "spec": {
30
+ "type": "object",
31
+ "additionalProperties": false,
32
+ "required": ["actionType", "target", "summary", "riskLane", "requestedPermissions", "artifacts", "dryRun", "security"],
33
+ "properties": {
34
+ "actionType": { "$ref": "capability-pack.schema.json#/$defs/actionType" },
35
+ "target": {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "required": ["provider", "resource"],
39
+ "properties": {
40
+ "provider": { "$ref": "capability-pack.schema.json#/$defs/name" },
41
+ "resource": { "type": "string", "minLength": 1, "maxLength": 256 },
42
+ "environment": { "$ref": "capability-pack.schema.json#/$defs/name" }
43
+ }
44
+ },
45
+ "summary": { "type": "string", "minLength": 1, "maxLength": 500 },
46
+ "riskLane": { "const": "high-risk" },
47
+ "requestedPermissions": {
48
+ "type": "array",
49
+ "maxItems": 32,
50
+ "uniqueItems": true,
51
+ "items": {
52
+ "type": "string",
53
+ "minLength": 1,
54
+ "maxLength": 128,
55
+ "pattern": "^[a-z0-9][a-z0-9:-]{0,127}$"
56
+ }
57
+ },
58
+ "artifacts": {
59
+ "type": "array",
60
+ "maxItems": 32,
61
+ "items": {
62
+ "type": "object",
63
+ "additionalProperties": false,
64
+ "required": ["path", "digest", "mediaType", "byteSize"],
65
+ "properties": {
66
+ "path": { "$ref": "capability-pack.schema.json#/$defs/relativePath" },
67
+ "digest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
68
+ "mediaType": {
69
+ "type": "string",
70
+ "minLength": 3,
71
+ "maxLength": 128,
72
+ "pattern": "^[a-zA-Z0-9][a-zA-Z0-9.+-]*\\/[a-zA-Z0-9][a-zA-Z0-9.+-]*$"
73
+ },
74
+ "byteSize": { "type": "integer", "minimum": 0, "maximum": 10485760 }
75
+ }
76
+ }
77
+ },
78
+ "dryRun": { "const": true },
79
+ "security": {
80
+ "type": "object",
81
+ "additionalProperties": false,
82
+ "required": ["containsSecrets"],
83
+ "properties": {
84
+ "containsSecrets": { "const": false }
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
@@ -0,0 +1,190 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/Vt-mmm/piagent/schemas/capability-pack.schema.json",
4
+ "title": "Pi Agent Capability Pack",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["apiVersion", "kind", "metadata", "spec"],
8
+ "properties": {
9
+ "apiVersion": { "const": "piagent/v1" },
10
+ "kind": { "const": "CapabilityPack" },
11
+ "metadata": { "$ref": "#/$defs/metadata" },
12
+ "spec": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["coreApiVersion", "requires", "provides", "permissions", "activation", "verification"],
16
+ "properties": {
17
+ "coreApiVersion": { "const": 1 },
18
+ "requires": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "required": ["packs"],
22
+ "properties": {
23
+ "packs": {
24
+ "type": "array",
25
+ "maxItems": 64,
26
+ "uniqueItems": true,
27
+ "items": { "$ref": "#/$defs/packDependency" }
28
+ }
29
+ }
30
+ },
31
+ "provides": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": ["prompts", "skills", "subagents", "policies", "adapters", "recipes", "evals"],
35
+ "properties": {
36
+ "prompts": { "$ref": "#/$defs/artifacts" },
37
+ "skills": { "$ref": "#/$defs/artifacts" },
38
+ "subagents": { "$ref": "#/$defs/artifacts" },
39
+ "policies": { "$ref": "#/$defs/artifacts" },
40
+ "adapters": { "$ref": "#/$defs/artifacts" },
41
+ "recipes": { "$ref": "#/$defs/artifacts" },
42
+ "evals": { "$ref": "#/$defs/artifacts" }
43
+ }
44
+ },
45
+ "permissions": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "required": ["capabilities", "filesystemRead", "filesystemWrite", "networkDomains", "externalActions"],
49
+ "properties": {
50
+ "capabilities": { "$ref": "#/$defs/names" },
51
+ "filesystemRead": { "$ref": "#/$defs/pathPatterns" },
52
+ "filesystemWrite": { "$ref": "#/$defs/pathPatterns" },
53
+ "networkDomains": {
54
+ "type": "array",
55
+ "maxItems": 64,
56
+ "uniqueItems": true,
57
+ "items": {
58
+ "type": "string",
59
+ "maxLength": 253,
60
+ "pattern": "^(?:\\*\\.)?[a-z0-9](?:[a-z0-9.-]{0,251}[a-z0-9])?$"
61
+ }
62
+ },
63
+ "externalActions": {
64
+ "type": "array",
65
+ "maxItems": 32,
66
+ "uniqueItems": true,
67
+ "items": { "$ref": "#/$defs/actionType" }
68
+ }
69
+ }
70
+ },
71
+ "activation": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "required": ["mode", "profiles", "triggers"],
75
+ "properties": {
76
+ "mode": { "enum": ["explicit", "profile", "trigger"] },
77
+ "profiles": { "$ref": "#/$defs/names" },
78
+ "triggers": {
79
+ "type": "array",
80
+ "maxItems": 64,
81
+ "uniqueItems": true,
82
+ "items": { "type": "string", "minLength": 1, "maxLength": 256 }
83
+ }
84
+ },
85
+ "allOf": [
86
+ {
87
+ "if": { "properties": { "mode": { "const": "trigger" } } },
88
+ "then": { "properties": { "triggers": { "minItems": 1 } } }
89
+ }
90
+ ]
91
+ },
92
+ "verification": {
93
+ "type": "object",
94
+ "additionalProperties": false,
95
+ "required": ["evalScenarios"],
96
+ "properties": {
97
+ "evalScenarios": {
98
+ "type": "array",
99
+ "maxItems": 64,
100
+ "uniqueItems": true,
101
+ "items": { "$ref": "#/$defs/identifier" }
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+ },
108
+ "$defs": {
109
+ "name": {
110
+ "type": "string",
111
+ "minLength": 1,
112
+ "maxLength": 64,
113
+ "pattern": "^[a-z0-9][a-z0-9-]{0,63}$"
114
+ },
115
+ "identifier": {
116
+ "type": "string",
117
+ "minLength": 1,
118
+ "maxLength": 128,
119
+ "pattern": "^[a-z0-9][a-z0-9._/-]{0,127}$"
120
+ },
121
+ "version": {
122
+ "type": "string",
123
+ "maxLength": 64,
124
+ "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?$"
125
+ },
126
+ "metadata": {
127
+ "type": "object",
128
+ "additionalProperties": false,
129
+ "required": ["name", "version", "owner", "lifecycle", "license", "description", "tags"],
130
+ "properties": {
131
+ "name": { "$ref": "#/$defs/name" },
132
+ "version": { "$ref": "#/$defs/version" },
133
+ "owner": { "$ref": "#/$defs/name" },
134
+ "lifecycle": { "enum": ["experimental", "stable", "deprecated"] },
135
+ "license": { "type": "string", "minLength": 1, "maxLength": 64 },
136
+ "description": { "type": "string", "minLength": 1, "maxLength": 240 },
137
+ "tags": { "$ref": "#/$defs/names" }
138
+ }
139
+ },
140
+ "packDependency": {
141
+ "type": "object",
142
+ "additionalProperties": false,
143
+ "required": ["name", "version"],
144
+ "properties": {
145
+ "name": { "$ref": "#/$defs/name" },
146
+ "version": { "$ref": "#/$defs/version" }
147
+ }
148
+ },
149
+ "artifact": {
150
+ "type": "object",
151
+ "additionalProperties": false,
152
+ "required": ["id", "path"],
153
+ "properties": {
154
+ "id": { "$ref": "#/$defs/identifier" },
155
+ "path": { "$ref": "#/$defs/relativePath" }
156
+ }
157
+ },
158
+ "artifacts": {
159
+ "type": "array",
160
+ "maxItems": 128,
161
+ "items": { "$ref": "#/$defs/artifact" }
162
+ },
163
+ "names": {
164
+ "type": "array",
165
+ "maxItems": 64,
166
+ "uniqueItems": true,
167
+ "items": { "$ref": "#/$defs/name" }
168
+ },
169
+ "relativePath": {
170
+ "type": "string",
171
+ "minLength": 1,
172
+ "maxLength": 512,
173
+ "pattern": "^(?!/)(?![A-Za-z]:)(?!.*\\\\)(?!.*(?:^|/)\\.\\.(?:/|$))[^*?\\[\\]{}]+$"
174
+ },
175
+ "pathPatterns": {
176
+ "type": "array",
177
+ "maxItems": 128,
178
+ "uniqueItems": true,
179
+ "items": {
180
+ "type": "string",
181
+ "minLength": 1,
182
+ "maxLength": 512,
183
+ "pattern": "^(?!/)(?![A-Za-z]:)(?!.*\\\\)(?!.*(?:^|/)\\.\\.(?:/|$)).+$"
184
+ }
185
+ },
186
+ "actionType": {
187
+ "enum": ["git-push", "github-pull-request", "github-issue", "release", "publish", "deploy", "database-change", "external-provider-write"]
188
+ }
189
+ }
190
+ }
@@ -0,0 +1,72 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/Vt-mmm/piagent/schemas/capability-recipe.schema.json",
4
+ "title": "Pi Agent Capability Recipe",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["apiVersion", "kind", "metadata", "spec"],
8
+ "properties": {
9
+ "apiVersion": { "const": "piagent/v1" },
10
+ "kind": { "const": "CapabilityRecipe" },
11
+ "metadata": { "$ref": "capability-pack.schema.json#/$defs/metadata" },
12
+ "spec": {
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "required": ["inputs", "steps", "gates"],
16
+ "properties": {
17
+ "inputs": {
18
+ "type": "array",
19
+ "maxItems": 32,
20
+ "items": {
21
+ "type": "object",
22
+ "additionalProperties": false,
23
+ "required": ["name", "description", "required"],
24
+ "properties": {
25
+ "name": { "$ref": "capability-pack.schema.json#/$defs/name" },
26
+ "description": { "type": "string", "minLength": 1, "maxLength": 240 },
27
+ "required": { "type": "boolean" }
28
+ }
29
+ }
30
+ },
31
+ "steps": {
32
+ "type": "array",
33
+ "minItems": 1,
34
+ "maxItems": 64,
35
+ "items": {
36
+ "type": "object",
37
+ "additionalProperties": false,
38
+ "required": ["id", "uses", "mode", "needs", "timeoutSeconds", "retries", "outputs"],
39
+ "properties": {
40
+ "id": { "$ref": "capability-pack.schema.json#/$defs/name" },
41
+ "uses": {
42
+ "type": "string",
43
+ "maxLength": 128,
44
+ "pattern": "^(?:capability|recipe):[a-z0-9][a-z0-9._/-]{0,111}$"
45
+ },
46
+ "mode": { "enum": ["read-only", "workspace-write", "action-proposal"] },
47
+ "needs": { "$ref": "capability-pack.schema.json#/$defs/names" },
48
+ "timeoutSeconds": { "type": "integer", "minimum": 1, "maximum": 3600 },
49
+ "retries": { "type": "integer", "minimum": 0, "maximum": 3 },
50
+ "outputs": {
51
+ "type": "array",
52
+ "maxItems": 32,
53
+ "uniqueItems": true,
54
+ "items": { "$ref": "capability-pack.schema.json#/$defs/identifier" }
55
+ }
56
+ }
57
+ }
58
+ },
59
+ "gates": {
60
+ "type": "object",
61
+ "additionalProperties": false,
62
+ "required": ["context", "verification", "humanApproval"],
63
+ "properties": {
64
+ "context": { "type": "boolean" },
65
+ "verification": { "type": "boolean" },
66
+ "humanApproval": { "type": "boolean" }
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }