diff --git a/.env.example b/.env.example
old mode 100755
new mode 100644
diff --git a/.gitea/workflows/build-images.yaml b/.gitea/workflows/build-images.yaml
old mode 100755
new mode 100644
index 1820629..81d95d9
--- a/.gitea/workflows/build-images.yaml
+++ b/.gitea/workflows/build-images.yaml
@@ -11,30 +11,42 @@ concurrency:
cancel-in-progress: false
jobs:
+ plan:
+ runs-on: ubuntu-latest
+ outputs:
+ matrix: ${{ steps.matrix.outputs.matrix }}
+ steps:
+ - name: Check out repository
+ uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
+ - name: Install manifest dependency
+ run: apt-get update && apt-get install -y python3-yaml
+ - name: Check generated platform files
+ run: python3 scripts/generate-platform.py --check
+ - name: Generate build matrix
+ id: matrix
+ run: printf 'matrix=%s\n' "$(python3 scripts/generate-platform.py --matrix gitea)" >> "$GITHUB_OUTPUT"
+
build:
+ needs: plan
runs-on: incus
timeout-minutes: 240
strategy:
fail-fast: false
max-parallel: 1
- matrix:
- variant: [base, php, python, cpp, typescript, full]
+ matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
steps:
- name: Check out repository
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
-
- name: Validate repository
run: ./tests/validate-repository.sh
-
- name: Verify Incus build runner
- run: ./scripts/ci/check-incus-runner.sh
-
+ run: |
+ ./scripts/ci/check-incus-runner.sh
+ ./scripts/ci/check-architecture.sh "${{ matrix.architecture }}"
- name: Build image
run: ./scripts/build-image.sh "${{ matrix.variant }}"
-
- name: Package image
run: ./scripts/package-image.sh "${{ matrix.variant }}"
-
- name: Publish Gitea Generic Package
if: ${{ startsWith(gitea.ref, 'refs/tags/v') }}
env:
diff --git a/.gitea/workflows/validate.yaml b/.gitea/workflows/validate.yaml
old mode 100755
new mode 100644
index 03d5581..dac6d19
--- a/.gitea/workflows/validate.yaml
+++ b/.gitea/workflows/validate.yaml
@@ -18,7 +18,7 @@ jobs:
- name: Install validation dependencies
run: |
apt-get update
- apt-get install -y jq shellcheck yamllint
+ apt-get install -y jq python3-yaml shellcheck yamllint
- name: Validate repository
run: ./tests/validate-repository.sh
diff --git a/.github/workflows/build-images.yaml b/.github/workflows/build-images.yaml
old mode 100755
new mode 100644
index 96b1479..d3c72f7
--- a/.github/workflows/build-images.yaml
+++ b/.github/workflows/build-images.yaml
@@ -14,39 +14,50 @@ concurrency:
cancel-in-progress: false
jobs:
+ plan:
+ runs-on: ubuntu-24.04
+ outputs:
+ matrix: ${{ steps.matrix.outputs.matrix }}
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ - name: Install manifest dependency
+ run: sudo apt-get update && sudo apt-get install -y python3-yaml
+ - name: Check generated platform files
+ run: python3 scripts/generate-platform.py --check
+ - name: Generate build matrix
+ id: matrix
+ run: printf 'matrix=%s\n' "$(python3 scripts/generate-platform.py --matrix github)" >> "$GITHUB_OUTPUT"
+
build:
+ needs: plan
runs-on: [self-hosted, linux, incus]
timeout-minutes: 240
strategy:
fail-fast: false
max-parallel: 1
- matrix:
- variant: [base, php, python, cpp, typescript, full]
+ matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
-
- name: Validate repository
run: ./tests/validate-repository.sh
-
- name: Verify Incus build runner
- run: ./scripts/ci/check-incus-runner.sh
-
+ run: |
+ ./scripts/ci/check-incus-runner.sh
+ ./scripts/ci/check-architecture.sh "${{ matrix.architecture }}"
- name: Build image
run: ./scripts/build-image.sh "${{ matrix.variant }}"
-
- name: Package image
run: ./scripts/package-image.sh "${{ matrix.variant }}"
-
- name: Upload downloadable image package
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
- name: vdm-opencode-${{ matrix.variant }}-${{ github.ref_name }}
- path: build/packages/*/${{ matrix.variant }}/
+ name: vdm-opencode-${{ matrix.variant }}-${{ matrix.architecture }}-${{ github.ref_name }}
+ path: build/packages/*/${{ matrix.architecture }}/${{ matrix.variant }}/
if-no-files-found: error
compression-level: 0
retention-days: 30
-
- name: Publish Gitea Generic Package
if: ${{ startsWith(github.ref, 'refs/tags/v') && vars.GITEA_PUBLISH_ENABLED == 'true' }}
env:
diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml
old mode 100755
new mode 100644
index 5c12f25..f8f635f
--- a/.github/workflows/validate.yaml
+++ b/.github/workflows/validate.yaml
@@ -25,7 +25,7 @@ jobs:
- name: Install validation dependencies
run: |
sudo apt-get update
- sudo apt-get install -y jq shellcheck yamllint
+ sudo apt-get install -y jq python3-yaml shellcheck yamllint
- name: Validate repository
run: ./tests/validate-repository.sh
diff --git a/CHANGELOG.md b/CHANGELOG.md
old mode 100755
new mode 100644
index f2cf63d..2ebde63
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+## 0.3.0-rc.1 - 2026-07-22
+
+- Made `manifest/images.yaml` the schema-validated authority for composition,
+ architectures, policies, sizes, profiles and GitHub/Gitea matrices.
+- Added GPL-3.0-only licensing and Vast Development Method copyright ownership.
+- Added restricted Incus projects, public-only connected egress, offline and
+ fail-closed gateway policies, enforced session TTLs and VM expiry reaping.
+- Removed Java and split browser/database provisioning into reusable components.
+- Added architecture-safe artifacts, provenance, SBOM/Grype release gates,
+ OpenBao-backed Cosign hooks and upload-last Gitea completion markers.
+- Added OpenAI, Claude, Gemini, Grok and local gateway routes plus Git/VPS
+ capability-path documentation.
+- Added static manifest, security, drift, matrix and artifact tamper tests.
+
## 0.2.0 - 2026-07-22
- Split GitHub and Gitea workflows so each uses its own expression context and runner model.
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 0000000..aa3eca6
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,8 @@
+VDM OpenCode Platform
+
+Copyright (C) 2026 Vast Development Method
+
+Vast Development Method is the copyright holder for the original source code,
+configuration, documentation, and other original works in this repository.
+
+SPDX-License-Identifier: GPL-3.0-only
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f288702
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ Copyright (C)
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+.
diff --git a/Makefile b/Makefile
index d4e3b96..f354b62 100644
--- a/Makefile
+++ b/Makefile
@@ -1,47 +1,32 @@
SHELL := /usr/bin/env bash
-.PHONY: help validate bootstrap apply-incus build-base build-php build-python build-cpp build-typescript build-full build-all local-release
+.PHONY: help validate generate bootstrap apply-incus build build-all local-release
help:
@printf '%s\n' \
- 'make validate Validate repository syntax and secret hygiene' \
- 'make bootstrap Install host prerequisites and initialise Incus' \
- 'make apply-incus Apply project, networks, ACL and profiles' \
- 'make build-base Build the base image' \
- 'make build-php Build the PHP/Joomla image' \
- 'make build-python Build the Python image' \
- 'make build-cpp Build the C/C++ image' \
- 'make build-typescript Build the TypeScript/browser image' \
- 'make build-full Build the full mixed-language image' \
- 'make build-all Build every image variant' \
+ 'make validate Validate repository syntax, generated state and security contracts' \
+ 'make generate Regenerate all derived platform files from manifest/images.yaml' \
+ 'make bootstrap Install host prerequisites, Incus and the TTL reaper' \
+ 'make apply-incus Apply restricted project, networks, ACLs and profiles' \
+ 'make build IMAGE=php Build one manifest-defined image' \
+ 'make build-all Build every release-enabled image' \
'make local-release Build, package, verify and optionally publish locally'
validate:
./tests/validate-repository.sh
+generate:
+ python3 ./scripts/generate-platform.py --write
+
bootstrap:
./scripts/bootstrap-host.sh
apply-incus:
./scripts/apply-incus.sh
-build-base:
- ./scripts/build-image.sh base
-
-build-php:
- ./scripts/build-image.sh php
-
-build-python:
- ./scripts/build-image.sh python
-
-build-cpp:
- ./scripts/build-image.sh cpp
-
-build-typescript:
- ./scripts/build-image.sh typescript
-
-build-full:
- ./scripts/build-image.sh full
+build:
+ @test -n "$(IMAGE)" || { printf 'IMAGE is required (for example: make build IMAGE=php)\n' >&2; exit 2; }
+ ./scripts/build-image.sh "$(IMAGE)"
build-all:
./scripts/build-all-images.sh
diff --git a/NOTICE.md b/NOTICE.md
index 3f1dcc5..88f1cfb 100644
--- a/NOTICE.md
+++ b/NOTICE.md
@@ -1,7 +1,11 @@
-# Internal platform notice
+# VDM OpenCode Platform notice
-This repository is an internal VDM platform definition. It intentionally contains no provider credentials,
-Git credentials, Vaultwarden credentials, OpenBao tokens, Nextcloud app passwords, Joomla API tokens,
-private SSH keys, or private source repositories.
+Copyright (C) 2026 Vast Development Method.
-Choose and add an explicit software licence before publishing this repository outside the company.
+The original repository source is licensed under GNU GPL version 3 only
+(`GPL-3.0-only`). Software installed into generated VM images retains its own
+copyright and licence; an image SBOM is the authority for redistributed
+third-party components.
+
+This repository intentionally contains no provider credentials, Git
+credentials, OpenBao tokens, private SSH keys, or private source repositories.
diff --git a/README.md b/README.md
old mode 100755
new mode 100644
index c8e98e5..099736f
--- a/README.md
+++ b/README.md
@@ -92,3 +92,12 @@ Start with:
- `docs/gitea-packages.md`
- `docs/github-and-gitea.md`
- `docs/backup-and-migration.md`
+
+## Licence and ownership
+
+Copyright (C) 2026 Vast Development Method.
+
+The original repository source is licensed under the GNU General Public
+License version 3 only (`GPL-3.0-only`). See `LICENSE` and `COPYRIGHT`.
+Generated images contain independently licensed third-party software whose
+licences are recorded by the release SBOM.
diff --git a/VERSION b/VERSION
old mode 100755
new mode 100644
index 0ea3a94..8f2e859
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.2.0
+0.3.0-rc.1
diff --git a/broker/.env.example b/broker/.env.example
index 1699619..4c756d2 100644
--- a/broker/.env.example
+++ b/broker/.env.example
@@ -8,6 +8,14 @@ OPENBAO_ADDR=http://openbao:8200
# Never commit real provider keys.
OPENAI_API_KEY=
+OPENAI_MODEL=
ANTHROPIC_API_KEY=
+ANTHROPIC_MODEL=
+GEMINI_API_KEY=
+GEMINI_MODEL=
XAI_API_KEY=
+XAI_MODEL=
+LOCAL_MODEL=
+LOCAL_OPENAI_BASE_URL=
+LOCAL_OPENAI_API_KEY=
LITELLM_MASTER_KEY=
diff --git a/broker/compose.yaml b/broker/compose.yaml
index ad796ee..504afc5 100644
--- a/broker/compose.yaml
+++ b/broker/compose.yaml
@@ -15,8 +15,16 @@ services:
command: ["--config", "/etc/litellm/config.yaml", "--port", "4000"]
environment:
OPENAI_API_KEY: ${OPENAI_API_KEY:-}
+ OPENAI_MODEL: ${OPENAI_MODEL:?Set an approved OpenAI provider/model route}
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-}
+ ANTHROPIC_MODEL: ${ANTHROPIC_MODEL:?Set an approved Anthropic provider/model route}
+ GEMINI_API_KEY: ${GEMINI_API_KEY:-}
+ GEMINI_MODEL: ${GEMINI_MODEL:?Set an approved Gemini provider/model route}
XAI_API_KEY: ${XAI_API_KEY:-}
+ XAI_MODEL: ${XAI_MODEL:?Set an approved xAI provider/model route}
+ LOCAL_MODEL: ${LOCAL_MODEL:?Set an approved local provider/model route}
+ LOCAL_OPENAI_BASE_URL: ${LOCAL_OPENAI_BASE_URL:?Set the local OpenAI-compatible endpoint}
+ LOCAL_OPENAI_API_KEY: ${LOCAL_OPENAI_API_KEY:-local}
LITELLM_MASTER_KEY: ${LITELLM_MASTER_KEY:?Set a broker master key through secret injection}
volumes:
- ./config/litellm.yaml:/etc/litellm/config.yaml:ro
diff --git a/broker/config/litellm.yaml b/broker/config/litellm.yaml
index bffe6b3..6fb3a29 100644
--- a/broker/config/litellm.yaml
+++ b/broker/config/litellm.yaml
@@ -1,24 +1,29 @@
model_list:
- model_name: openai-default
litellm_params:
- model: openai/REPLACE_WITH_APPROVED_MODEL
+ model: os.environ/OPENAI_MODEL
api_key: os.environ/OPENAI_API_KEY
- model_name: anthropic-default
litellm_params:
- model: anthropic/REPLACE_WITH_APPROVED_MODEL
+ model: os.environ/ANTHROPIC_MODEL
api_key: os.environ/ANTHROPIC_API_KEY
+ - model_name: gemini-default
+ litellm_params:
+ model: os.environ/GEMINI_MODEL
+ api_key: os.environ/GEMINI_API_KEY
+
- model_name: xai-default
litellm_params:
- model: xai/REPLACE_WITH_APPROVED_MODEL
+ model: os.environ/XAI_MODEL
api_key: os.environ/XAI_API_KEY
- - model_name: local-llama
+ - model_name: local-default
litellm_params:
- model: openai/REPLACE_WITH_LOCAL_MODEL_ID
- api_base: http://local-llm.internal:11434/v1
- api_key: local
+ model: os.environ/LOCAL_MODEL
+ api_base: os.environ/LOCAL_OPENAI_BASE_URL
+ api_key: os.environ/LOCAL_OPENAI_API_KEY
general_settings:
master_key: os.environ/LITELLM_MASTER_KEY
diff --git a/broker/policies/release-signer.hcl b/broker/policies/release-signer.hcl
new file mode 100644
index 0000000..81af41c
--- /dev/null
+++ b/broker/policies/release-signer.hcl
@@ -0,0 +1,9 @@
+# The release job can inspect the public key and ask Transit to sign digests.
+# It cannot export key material or read unrelated secrets.
+path "transit/keys/vdm-opencode-release" {
+ capabilities = ["read"]
+}
+
+path "transit/sign/vdm-opencode-release/*" {
+ capabilities = ["update"]
+}
diff --git a/broker/policies/session-broker.hcl b/broker/policies/session-broker.hcl
new file mode 100644
index 0000000..ef6ea75
--- /dev/null
+++ b/broker/policies/session-broker.hcl
@@ -0,0 +1,21 @@
+# Applied only to the trusted external session broker. Agent VMs never receive
+# an OpenBao token and never access these paths.
+path "secret/data/providers/*" {
+ capabilities = ["read"]
+}
+
+path "pki_int/issue/agent-session" {
+ capabilities = ["update"]
+}
+
+path "ssh-client-signer/sign/agent-session" {
+ capabilities = ["update"]
+}
+
+path "auth/token/lookup-self" {
+ capabilities = ["read"]
+}
+
+path "auth/token/renew-self" {
+ capabilities = ["update"]
+}
diff --git a/docs/credentials-and-brokers.md b/docs/credentials-and-brokers.md
old mode 100755
new mode 100644
index 9897e24..9bf1710
--- a/docs/credentials-and-brokers.md
+++ b/docs/credentials-and-brokers.md
@@ -24,6 +24,31 @@ A trusted broker host should retain long-lived upstream credentials and expose o
The VM must never receive a Vaultwarden or OpenBao identity capable of reading all upstream secrets.
+## Provider capability paths
+
+Autonomous sessions use one route for each provider:
+
+- OpenAI API, Anthropic/Claude API, Google Gemini API and xAI/Grok API:
+ OpenBao-held upstream credential → LiteLLM policy route → short-lived session
+ virtual key → root-owned guest relay → tokenless local OpenCode endpoint.
+- Local models: the gateway exposes approved OpenAI-compatible inference
+ routes only. Model administration and the host Ollama/API port remain
+ unreachable from agent networks.
+- ChatGPT subscription login: interactive developer sessions may use
+ OpenCode's supported login inside tmpfs. It is not an autonomous production
+ credential path.
+- GitHub: the gateway mints a GitHub App installation token scoped to selected
+ repositories and operations.
+- Gitea and remote MCP: the gateway retains the service credential and checks
+ session identity, repository, tool, read/write level and expiry per request.
+- VPS access: the VM creates an ephemeral key; OpenBao SSH CA signs the public
+ key for 10–15 minutes; the network policy permits only the audited bastion.
+
+The current environment-file bridge is transitional. It now uses systemd
+credentials and avoids secret values in host process arguments, but child
+commands can still exercise or inspect exported session variables. Release
+promotion requires the tokenless root-owned relay described above.
+
## OpenBao
OpenBao is suitable for machine identity, short leases, revocation and audit. The agent should not query secret
diff --git a/docs/gitea-packages.md b/docs/gitea-packages.md
old mode 100755
new mode 100644
diff --git a/docs/github-and-gitea.md b/docs/github-and-gitea.md
old mode 100755
new mode 100644
diff --git a/docs/image-variants.md b/docs/image-variants.md
index de89995..e7e20a9 100644
--- a/docs/image-variants.md
+++ b/docs/image-variants.md
@@ -1,39 +1,48 @@
-# Image variants
+# Composable images, capabilities, policies and sizes
-## Common base
+`manifest/images.yaml` is the sole platform authority. Run
+`python3 scripts/generate-platform.py --write` after an intentional manifest
+change; validation fails when any derived profile, shell list, version or CI
+matrix is stale.
-Every image includes Git, OpenCode, Node.js, Python runtime support, `uv`, `jq`, shell tooling, the common agents,
-managed OpenCode policy and local Git MCP.
+## Release images
-Python is present in the base only because the Git MCP reference server is Python-based. The Python project image
-adds development and quality tooling.
+- `base`: shell-oriented analysis and documentation.
+- `php`: PHP/Joomla/JCB plus Node, TypeScript, browser and database clients.
+- `python`: Python development, quality tools and MCP services.
+- `cpp`: C/C++ compilers, debuggers, build tools and analysis.
+- `typescript`: Node, TypeScript, browser automation and Playwright MCP.
+- `full`: the union of the ready language and packaged capabilities.
-## PHP
+Java, Go and Rust are intentionally absent. Android is a planned capability
+whose future SDK may require a JDK internally; that will not create a general
+Java development image.
-Adds PHP CLI extensions, Composer and MariaDB client. It also adds Chromium and Playwright because Joomla and JCB
-work normally requires browser verification.
+## Build-time capabilities
-## Python
+Browser and database are ready composable components. Android, GPU, rootless
+containers, GUI, audio and security tooling are catalogued as planned so the
+schema can grow without inventing combinations or claiming unfinished support.
-Adds Python headers, pytest, Ruff and mypy.
+## Runtime policies
-## C/C++
+- `offline`: no egress.
+- `connected`: public Internet with private, management, link-local and
+ metadata networks rejected.
+- `brokered`, `restricted` and `release`: fail closed until the external
+ gateway/proxy is deployed and tested.
+- `lab`: experimental hardware policy requiring explicit acknowledgement.
-Adds Clang, clang-tidy, CMake, Ninja, GDB, LLDB, Valgrind, cppcheck and gcovr.
+## Resource sizes
-## TypeScript
+Tiny, small, medium, standard, large, xlarge and builder profiles are selected
+at VM launch. They are independent of image composition, avoiding a
+combinatorial image catalogue.
-Adds TypeScript, tsx, Playwright MCP, Playwright and Chromium.
+## Adding support
-## Full
-
-Adds every language toolchain and Java 21. Use this only when a repository genuinely needs the combined stack.
-
-## Adding a variant
-
-1. Add a provisioning script under `image/provision`.
-2. Add a profile under `incus/profiles`.
-3. Add the variant to `manifest/images.yaml`.
-4. Extend `variant_exists` and the build matrix.
-5. Add smoke tests.
-6. Build from a clean base and record the resulting tool versions.
+1. Add a component and dimension entry to `manifest/images.yaml`.
+2. Keep it `planned` until provisioning, pins and verification exist.
+3. Add the provisioning script and smoke/security tests.
+4. Mark it `ready`, include it in the intended image, regenerate and validate.
+5. Build, export, independently import and record promotion evidence.
diff --git a/docs/jcb-mcp-roadmap.md b/docs/jcb-mcp-roadmap.md
old mode 100755
new mode 100644
diff --git a/docs/joomla-mcp-study.md b/docs/joomla-mcp-study.md
old mode 100755
new mode 100644
diff --git a/docs/known-limitations.md b/docs/known-limitations.md
old mode 100755
new mode 100644
index 06df2dd..60a6a77
--- a/docs/known-limitations.md
+++ b/docs/known-limitations.md
@@ -1,13 +1,26 @@
# Known limitations
-- The repository has been statically validated, but the image build was not executed in this delivery environment
- because nested Incus and external package downloads are unavailable here.
-- Ubuntu/Node/PHP system packages are resolved from the configured repositories at build time; their exact installed
- versions are recorded inside each image manifest but are not yet sourced from a company snapshot mirror.
-- The Nextcloud candidate has not received a VDM security audit.
-- The VDM Joomla MCP and JCB MCP are intentionally not installed pending their first approved releases.
-- The reference broker does not yet implement the company MCP authorization gateway.
-- Incus ACLs currently provide inbound isolation but not strict DNS-aware outbound filtering.
-- GitHub image builds require a self-hosted runner labelled `self-hosted`, `linux`, `incus`. Gitea image builds
- require a host runner labelled `incus:host`.
-- OpenCode config compatibility should be revalidated whenever OpenCode is upgraded.
+- Static and mocked validation is available, but the six real Incus images have
+ not yet been built in this delivery environment.
+- Ubuntu and Node packages still resolve from upstream repositories. The
+ NodeSource setup input is content-pinned, and release manifests record the
+ result, but a timestamped Ubuntu/package snapshot has not yet been enabled.
+- Syft, Grype and Cosign hooks fail closed in release mode, but a trusted
+ builder still needs those pinned tools and a short-lived OpenBao signing
+ identity.
+- AMD64 is the only promotable architecture. ARM64 identities are collision-safe
+ but remain disabled until native ARM64 build/import evidence exists.
+- Connected policy denies private, metadata and management IPv4 ranges while
+ retaining public Internet. Host-side DNS-aware Squid policy is still required
+ before brokered, restricted and release policies can be unblocked.
+- Session secrets no longer appear in Incus command arguments and the process
+ tree has a systemd-enforced TTL. The transitional session process still
+ exports scoped credentials to OpenCode and its children; the tokenless
+ root-owned relay remains a release gate.
+- OpenBao/LiteLLM policies and routes are defined but the external broker,
+ authorization gateway, audit device, unseal, backup and revocation tests are
+ not deployed by this repository.
+- GitHub/Gitea builds require owned hardware-virtualisation runners. A second
+ independent clean host is mandatory for redistribution evidence.
+- OpenCode configuration compatibility must be revalidated whenever OpenCode is
+ upgraded.
diff --git a/docs/local-image-builds.md b/docs/local-image-builds.md
index 240f132..86b42c6 100644
--- a/docs/local-image-builds.md
+++ b/docs/local-image-builds.md
@@ -32,7 +32,9 @@ export LOCAL_BUILD_VARIANTS='php,typescript,full'
./scripts/local-image-release.sh
```
-Packages remain under `build/packages///`. Every package contains the Incus export, `manifest.json`, and `SHA256SUMS`; the release script verifies the checksums before it succeeds.
+Packages remain under `build/packages////`.
+Every package contains the Incus export, manifest, provenance and checksums;
+release mode additionally requires an SBOM, vulnerability scan and signature.
## Publish directly to Gitea
@@ -61,7 +63,7 @@ For a reproducible production release, build the exact protected tag and require
```bash
git fetch --tags --prune origin
-git switch --detach v0.2.0
+git switch --detach v0.3.0-rc.1
export LOCAL_BUILD_VARIANTS=all
export LOCAL_REQUIRE_CLEAN=true
@@ -79,7 +81,7 @@ export GITEA_PACKAGE_TOKEN
unset GITEA_PACKAGE_TOKEN
```
-Replace `v0.2.0` with the version being released. Tags must not be recreated or force-moved after packages are published.
+Replace `v0.3.0-rc.1` with the version being released. Tags must not be recreated or force-moved after packages are published.
## Supported environment variables
diff --git a/docs/mcp-catalog.md b/docs/mcp-catalog.md
old mode 100755
new mode 100644
diff --git a/docs/quick-start.md b/docs/quick-start.md
old mode 100755
new mode 100644
diff --git a/docs/roadmap.md b/docs/roadmap.md
old mode 100755
new mode 100644
index 0e15913..af8f42d
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -1,31 +1,61 @@
-# Roadmap
-
-## Phase 1: Baseline — implemented
-
-- Validate the repository on GitHub-hosted and Gitea runners.
-- Build all six variants on a trusted Incus runner.
-- Pilot local Git and Playwright MCP.
-- Configure ChatGPT Plus, Anthropic API, xAI API and local Llama routes.
-- Expose short-lived GitHub build artifacts and publish durable image packages to Gitea.
-
-## Phase 2: Broker
-
-- Deploy OpenBao and LLM gateway.
-- Implement short-lived virtual keys and budgets.
-- Put Gitea, GitHub and Nextcloud MCP behind the gateway.
-- Enforce DNS-aware egress policy.
-- Add central audit and revocation tests.
-
-## Phase 3: VDM Joomla and JCB
+# Roadmap and release-candidate gates
+
+## RC definition — implemented in source
+
+- Manifest schema 2 is the single authority for images, languages,
+ capabilities, policies, sizes, architectures, profiles and CI matrices.
+- Six composable release images remain: base, PHP, Python, C/C++, TypeScript
+ and full. Android, GPU, GUI, containers, audio and security tooling are
+ catalogued as planned and cannot enter a release matrix accidentally.
+- Incus restricted projects, fail-closed policy profiles, public-only connected
+ egress and session TTL enforcement are defined.
+- Architecture-specific package identities, SBOM/Grype hooks, provenance,
+ OpenBao-backed Cosign hooks, tamper verification and upload-last Gitea
+ completion markers are defined.
+- GPL-3.0-only licensing and Vast Development Method ownership are established.
+
+## RC evidence — next mandatory milestone
+
+The platform must not be promoted from RC until all gates pass:
+
+1. Bootstrap a clean Ubuntu host including QEMU/KVM and Incus.
+2. Build all six amd64 images from the exact protected commit/tag.
+3. Run language, browser, sanitisation and negative network tests.
+4. Generate SBOMs, pass the vulnerability policy and sign every package.
+5. Export every image and verify its signed package.
+6. Import, boot and smoke-test every package on a second clean amd64 host.
+7. Verify connected, offline and gateway policies against host, RFC1918,
+ metadata and public targets.
+8. Verify cgroup TTL termination after caller loss and host reaper cleanup.
+9. Exercise provider, GitHub App, Gitea MCP and short-lived SSH certificate
+ paths through the broker.
+10. Publish the signed completion index only after all evidence is present.
+
+ARM64 stays declared but non-promotable until equivalent native ARM64 evidence
+exists.
+
+## Broker and tokenless relay
+
+- Deploy OpenBao with audit, backup/restore, workload authentication and
+ carefully scoped policies.
+- Deploy LiteLLM and MCP authorization gateways.
+- Replace transitional session environment credentials with the root-owned
+ tokenless guest relay.
+- Configure self-hosted Squid allowlists for restricted and release policies.
+- Prove revocation, model budgets, repository/tool restrictions and bastion-only
+ VPS access.
+
+## Fleet self-service
+
+- Separate developer, builder and disposable automation Incus projects.
+- Add OIDC and self-hosted OpenFGA; ordinary users must never join
+ `incus-admin`.
+- Add a narrow provisioning API, task queue, quotas, ownership records, audit
+ events, health reconciliation, warm pools and automatic retirement.
+- Promote images through signed candidate/stable channels.
+
+## VDM Joomla and JCB
- Release and review `vast-development-method/joomla-mcp`.
-- Complete JCB MCP protocol and test suite.
-- Add each integration only after its own activation gate passes.
-
-## Phase 4: Fleet
-
-- Central Incus cluster.
-- Department profiles and quotas.
-- Image promotion channels.
-- Automated retirement and compliance reporting.
-- Disposable task VMs and pull-request-only automation.
+- Complete the JCB MCP protocol and test suite.
+- Add each integration only after its own activation and credential-scope gate.
diff --git a/docs/versioning-and-promotion.md b/docs/versioning-and-promotion.md
old mode 100755
new mode 100644
index b90b268..ddf6e91
--- a/docs/versioning-and-promotion.md
+++ b/docs/versioning-and-promotion.md
@@ -3,9 +3,9 @@
The repository version, image alias, Gitea package version and release tag must match.
```text
-Repository tag: v0.2.0
-Incus alias: vdm-opencode-php/0.2.0
-Gitea package: vdm-opencode-php/0.2.0
+Repository tag: v0.3.0-rc.1
+Incus alias: vdm-opencode-php/0.3.0-rc.1-amd64
+Gitea package: vdm-opencode-php-amd64/0.3.0-rc.1
Build manifest: /etc/vdm-opencode-platform/build.json
```
diff --git a/host/systemd/vdm-opencode-reaper.service.in b/host/systemd/vdm-opencode-reaper.service.in
new file mode 100644
index 0000000..2486e9a
--- /dev/null
+++ b/host/systemd/vdm-opencode-reaper.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Stop expired VDM OpenCode agent VMs
+After=incus.service
+Requires=incus.service
+
+[Service]
+Type=oneshot
+ExecStart=@ROOT_DIR@/scripts/reap-expired-vms.sh
+NoNewPrivileges=true
+PrivateTmp=true
+ProtectSystem=strict
+ProtectHome=true
diff --git a/host/systemd/vdm-opencode-reaper.timer b/host/systemd/vdm-opencode-reaper.timer
new file mode 100644
index 0000000..84c234d
--- /dev/null
+++ b/host/systemd/vdm-opencode-reaper.timer
@@ -0,0 +1,11 @@
+[Unit]
+Description=Check VDM OpenCode agent session TTLs every minute
+
+[Timer]
+OnBootSec=1min
+OnUnitActiveSec=1min
+AccuracySec=5s
+Persistent=true
+
+[Install]
+WantedBy=timers.target
diff --git a/image/files/etc/vdm-opencode-platform/authorities.env b/image/files/etc/vdm-opencode-platform/authorities.env
old mode 100755
new mode 100644
diff --git a/image/files/home/opencode/.config/opencode/agents/orchestrator.md b/image/files/home/opencode/.config/opencode/agents/orchestrator.md
index 4ceeeb2..bfae844 100644
--- a/image/files/home/opencode/.config/opencode/agents/orchestrator.md
+++ b/image/files/home/opencode/.config/opencode/agents/orchestrator.md
@@ -21,6 +21,10 @@ permission:
security: allow
browser-qa: allow
documenter: allow
+ php-joomla: allow
+ python: allow
+ cpp: allow
+ typescript: allow
---
You are the lead VDM engineering orchestrator.
@@ -34,5 +38,17 @@ For non-trivial work:
6. Use browser-qa for user-facing applications.
7. Send confirmed findings back for correction and repeat tests until clean.
+Every delegated task must include:
+
+- the exact objective and files in scope;
+- constraints and forbidden actions;
+- evidence required for completion;
+- the expected structured handoff: findings, changes, tests, residual risks.
+
+Do not treat a subagent's completion claim as evidence. Inspect its diff and
+test output before accepting the handoff. Keep one authoritative task ledger in
+the primary conversation and explicitly distinguish implemented, tested,
+blocked, and planned work.
+
Stay inside the current worktree. Never reveal credentials. Never push, merge, publish, release, delete branches,
rewrite history or modify production infrastructure without an explicit user instruction.
diff --git a/image/files/home/opencode/.config/opencode/opencode.json b/image/files/home/opencode/.config/opencode/opencode.json
old mode 100755
new mode 100644
diff --git a/image/files/usr/local/libexec/vdm-opencode-session b/image/files/usr/local/libexec/vdm-opencode-session
new file mode 100755
index 0000000..ca425a6
--- /dev/null
+++ b/image/files/usr/local/libexec/vdm-opencode-session
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+umask 077
+
+: "${CREDENTIALS_DIRECTORY:?systemd credential directory is required}"
+: "${VDM_SESSION_ID:?session id is required}"
+: "${VDM_AGENT_HOME:=/home/opencode}"
+: "${VDM_WORKSPACE_ROOT:=/workspace}"
+
+allowed_key() {
+ case "$1" in
+ VDM_LLM_GATEWAY_URL|VDM_LLM_GATEWAY_TOKEN|\
+ GITHUB_MCP_URL|GITHUB_MCP_TOKEN|\
+ GITEA_MCP_URL|GITEA_MCP_TOKEN|\
+ NEXTCLOUD_MCP_URL|NEXTCLOUD_MCP_TOKEN|\
+ JOOMLA_MCP_URL|JOOMLA_MCP_TOKEN|\
+ JCB_MCP_URL|JCB_MCP_TOKEN|\
+ STT_MCP_URL|STT_MCP_TOKEN|\
+ VDM_LOCAL_LLM_BASE_URL|VDM_LOCAL_LLM_MODEL) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+credential_file="$CREDENTIALS_DIRECTORY/session.env"
+while IFS= read -r line || [ -n "$line" ]; do
+ case "$line" in
+ ""|\#*) continue ;;
+ *=*)
+ key="${line%%=*}"
+ allowed_key "$key" || {
+ printf 'Rejected runtime credential key: %s\n' "$key" >&2
+ exit 2
+ }
+ value="${line#*=}"
+ declare -gx "$key=$value"
+ ;;
+ *)
+ printf 'Invalid runtime credential line.\n' >&2
+ exit 2
+ ;;
+ esac
+done < "$credential_file"
+
+export HOME="$VDM_AGENT_HOME"
+export USER=opencode
+export LOGNAME=opencode
+export PATH="$VDM_AGENT_HOME/.local/bin:/usr/local/bin:/usr/bin:/bin"
+export XDG_DATA_HOME="/run/vdm-opencode-$VDM_SESSION_ID/data"
+install -d -m 0700 "$XDG_DATA_HOME"
+cd "$VDM_WORKSPACE_ROOT"
+exec "$VDM_AGENT_HOME/.local/bin/opencode"
diff --git a/image/provision/browser.sh b/image/provision/browser.sh
new file mode 100755
index 0000000..dfc2a7a
--- /dev/null
+++ b/image/provision/browser.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+
+npm install --global \
+ "${PLAYWRIGHT_MCP_PACKAGE:?PLAYWRIGHT_MCP_PACKAGE is required}" \
+ "${PLAYWRIGHT_PACKAGE:?PLAYWRIGHT_PACKAGE is required}"
+install -d -m 0755 /opt/ms-playwright
+PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright npx playwright install --with-deps chromium
+
+playwright_mcp_path="$(command -v playwright-mcp)"
+ln -sfn "$playwright_mcp_path" /usr/local/bin/vdm-playwright-mcp
+
+[ "$(playwright --version | awk '{print $2}')" = "$PLAYWRIGHT_EXPECTED_VERSION" ]
+
+installed_mcp="$(npm list --global --json --depth=0 | jq -r '.dependencies["@playwright/mcp"].version')"
+[ "$installed_mcp" = "$PLAYWRIGHT_MCP_EXPECTED_VERSION" ]
+test -x /usr/local/bin/vdm-playwright-mcp
+
+CONFIG=/home/opencode/.config/opencode/opencode.json
+tmp="$(mktemp)"
+jq '.mcp.playwright.enabled = true' "$CONFIG" > "$tmp"
+install -o opencode -g opencode -m 0640 "$tmp" "$CONFIG"
+rm -f "$tmp"
diff --git a/image/provision/common.sh b/image/provision/common.sh
index 4b2e764..5e976d0 100755
--- a/image/provision/common.sh
+++ b/image/provision/common.sh
@@ -41,22 +41,28 @@ install -d -o "$AGENT_USER" -g "$AGENT_USER" -m 0700 "$AGENT_HOME/.local/share/o
install -d -m 0755 /etc/opencode /etc/vdm-opencode-platform
if ! command -v node >/dev/null 2>&1 || [ "$(node --version | sed 's/^v//' | cut -d. -f1)" -lt 20 ]; then
- curl -fsSL "https://deb.nodesource.com/setup_${NODE_MAJOR:-22}.x" | bash -
+ nodesource_setup="$(mktemp)"
+ trap 'rm -f "$nodesource_setup"' EXIT
+ curl --fail --silent --show-error --location \
+ "https://deb.nodesource.com/setup_${NODE_MAJOR:-22}.x" \
+ --output "$nodesource_setup"
+ printf '%s %s\n' \
+ "${NODESOURCE_SETUP_SHA256:?NODESOURCE_SETUP_SHA256 is required}" \
+ "$nodesource_setup" | sha256sum --check --strict
+ bash "$nodesource_setup"
+ rm -f "$nodesource_setup"
+ trap - EXIT
apt-get install -y --no-install-recommends nodejs
fi
-if ! command -v uv >/dev/null 2>&1; then
- curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh
-fi
-
npm install --global "${OPENCODE_PACKAGE:?OPENCODE_PACKAGE is required}"
opencode_path="$(command -v opencode)"
ln -sfn "$opencode_path" "$AGENT_HOME/.local/bin/opencode"
sudo -u "$AGENT_USER" -H env \
- UV_TOOL_BIN_DIR="$AGENT_HOME/.local/bin" \
- UV_TOOL_DIR="$AGENT_HOME/.local/share/uv/tools" \
- uv tool install --force "${GIT_MCP_PACKAGE:?GIT_MCP_PACKAGE is required}"
+ PIPX_HOME="$AGENT_HOME/.local/share/pipx" \
+ PIPX_BIN_DIR="$AGENT_HOME/.local/bin" \
+ pipx install --force "${GIT_MCP_PACKAGE:?GIT_MCP_PACKAGE is required}"
test -x "$AGENT_HOME/.local/bin/opencode"
test -x "$AGENT_HOME/.local/bin/mcp-server-git"
@@ -69,7 +75,7 @@ installed_opencode="$("$AGENT_HOME/.local/bin/opencode" --version | tr -d '[:spa
}
installed_git_mcp="$(sudo -u "$AGENT_USER" -H \
- "$AGENT_HOME/.local/share/uv/tools/mcp-server-git/bin/python" -c \
+ "$AGENT_HOME/.local/share/pipx/venvs/mcp-server-git/bin/python" -c \
'import importlib.metadata; print(importlib.metadata.version("mcp-server-git"))')"
[ "$installed_git_mcp" = "$GIT_MCP_EXPECTED_VERSION" ] || {
printf 'Git MCP version mismatch: expected %s, got %s\n' \
diff --git a/image/provision/database.sh b/image/provision/database.sh
new file mode 100755
index 0000000..c6d15da
--- /dev/null
+++ b/image/provision/database.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+export DEBIAN_FRONTEND=noninteractive
+
+apt-get update
+apt-get install -y --no-install-recommends \
+ mariadb-client \
+ postgresql-client \
+ sqlite3
+
+mariadb --version
+psql --version
+sqlite3 --version
diff --git a/image/provision/finalize.sh b/image/provision/finalize.sh
index 3989794..a4eedda 100755
--- a/image/provision/finalize.sh
+++ b/image/provision/finalize.sh
@@ -19,7 +19,7 @@ jq -n \
--arg built_at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--arg os "$os_label" \
--arg opencode "$(sudo -u "$AGENT_USER" -H "$AGENT_HOME/.local/bin/opencode" --version 2>/dev/null || true)" \
- --arg git_mcp "$(sudo -u "$AGENT_USER" -H "$AGENT_HOME/.local/share/uv/tools/mcp-server-git/bin/python" -c 'import importlib.metadata; print(importlib.metadata.version("mcp-server-git"))' 2>/dev/null || true)" \
+ --arg git_mcp "$(sudo -u "$AGENT_USER" -H "$AGENT_HOME/.local/share/pipx/venvs/mcp-server-git/bin/python" -c 'import importlib.metadata; print(importlib.metadata.version("mcp-server-git"))' 2>/dev/null || true)" \
--arg node "$(node --version 2>/dev/null || true)" \
--arg php "$(php -r 'echo PHP_VERSION;' 2>/dev/null || true)" \
--arg python "$(python3 --version 2>/dev/null || true)" \
@@ -51,6 +51,18 @@ rm -rf \
"$AGENT_HOME/.bash_history"
find "$AGENT_HOME" -type f \( -name '*.token' -o -name '*.secret' -o -name '.git-credentials' \) -delete
+cloud-init clean --logs --seed || true
+rm -f /etc/ssh/ssh_host_*
+rm -f /var/lib/systemd/random-seed
+rm -f /var/lib/dbus/machine-id
+: > /etc/machine-id
+journalctl --rotate >/dev/null 2>&1 || true
+journalctl --vacuum-time=1s >/dev/null 2>&1 || true
+rm -rf \
+ /var/log/journal/* \
+ /var/lib/cloud/instances/* \
+ /var/lib/dhcp/* \
+ /opt/vdm-build
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
chown -R "$AGENT_USER:$AGENT_USER" "$AGENT_HOME" /workspace
diff --git a/image/provision/full.sh b/image/provision/full.sh
deleted file mode 100755
index b557204..0000000
--- a/image/provision/full.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-set -Eeuo pipefail
-SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
-"$SCRIPT_DIR/php.sh"
-"$SCRIPT_DIR/python.sh"
-"$SCRIPT_DIR/cpp.sh"
-"$SCRIPT_DIR/typescript.sh"
-apt-get install -y --no-install-recommends openjdk-21-jdk
diff --git a/image/provision/php.sh b/image/provision/php.sh
index f678da5..c82325e 100755
--- a/image/provision/php.sh
+++ b/image/provision/php.sh
@@ -5,7 +5,6 @@ export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y --no-install-recommends \
composer \
- mariadb-client \
php-cli \
php-bcmath \
php-curl \
diff --git a/image/provision/typescript.sh b/image/provision/typescript.sh
index 2788dc3..de5bac9 100755
--- a/image/provision/typescript.sh
+++ b/image/provision/typescript.sh
@@ -1,29 +1,10 @@
#!/usr/bin/env bash
set -Eeuo pipefail
-export DEBIAN_FRONTEND=noninteractive
corepack enable
npm install --global \
"${TYPESCRIPT_PACKAGE:?TYPESCRIPT_PACKAGE is required}" \
- "${TSX_PACKAGE:?TSX_PACKAGE is required}" \
- "${PLAYWRIGHT_MCP_PACKAGE:?PLAYWRIGHT_MCP_PACKAGE is required}" \
- "${PLAYWRIGHT_PACKAGE:?PLAYWRIGHT_PACKAGE is required}"
-install -d -m 0755 /opt/ms-playwright
-PLAYWRIGHT_BROWSERS_PATH=/opt/ms-playwright npx playwright install --with-deps chromium
-
-playwright_mcp_path="$(command -v playwright-mcp)"
-ln -sfn "$playwright_mcp_path" /usr/local/bin/vdm-playwright-mcp
+ "${TSX_PACKAGE:?TSX_PACKAGE is required}"
[ "$(tsc --version | awk '{print $2}')" = "$TYPESCRIPT_EXPECTED_VERSION" ]
[ "$(tsx --version | awk 'NR == 1 {print $2}')" = "$TSX_EXPECTED_VERSION" ]
-[ "$(playwright --version | awk '{print $2}')" = "$PLAYWRIGHT_EXPECTED_VERSION" ]
-
-installed_mcp="$(npm list --global --json --depth=0 | jq -r '.dependencies["@playwright/mcp"].version')"
-[ "$installed_mcp" = "$PLAYWRIGHT_MCP_EXPECTED_VERSION" ]
-test -x /usr/local/bin/vdm-playwright-mcp
-
-CONFIG=/home/opencode/.config/opencode/opencode.json
-tmp="$(mktemp)"
-jq '.mcp.playwright.enabled = true' "$CONFIG" > "$tmp"
-install -o opencode -g opencode -m 0640 "$tmp" "$CONFIG"
-rm -f "$tmp"
diff --git a/incus/acls/generated/brokered.yaml b/incus/acls/generated/brokered.yaml
new file mode 100644
index 0000000..d1a779b
--- /dev/null
+++ b/incus/acls/generated/brokered.yaml
@@ -0,0 +1,20 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM generated egress policy: brokered'
+config: {}
+ingress: []
+egress:
+ - action: allow
+ description: Runtime DNS
+ destination: 10.248.18.1/32
+ protocol: udp
+ destination_port: '53'
+ - action: allow
+ description: Runtime DNS over TCP
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '53'
+ - action: allow
+ description: Capability gateway
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '443'
diff --git a/incus/acls/generated/connected.yaml b/incus/acls/generated/connected.yaml
new file mode 100644
index 0000000..2848980
--- /dev/null
+++ b/incus/acls/generated/connected.yaml
@@ -0,0 +1,43 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM generated egress policy: connected'
+config: {}
+ingress: []
+egress:
+ - action: allow
+ description: Runtime DNS
+ destination: 10.248.18.1/32
+ protocol: udp
+ destination_port: '53'
+ - action: allow
+ description: Runtime DNS over TCP
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '53'
+ - action: allow
+ description: Capability gateway
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '443'
+ - action: reject
+ description: Deny private or special-use IPv4
+ destination: 10.0.0.0/8
+ - action: reject
+ description: Deny private or special-use IPv4
+ destination: 100.64.0.0/10
+ - action: reject
+ description: Deny private or special-use IPv4
+ destination: 127.0.0.0/8
+ - action: reject
+ description: Deny private or special-use IPv4
+ destination: 169.254.0.0/16
+ - action: reject
+ description: Deny private or special-use IPv4
+ destination: 172.16.0.0/12
+ - action: reject
+ description: Deny private or special-use IPv4
+ destination: 192.168.0.0/16
+ - action: reject
+ description: Deny private or special-use IPv4
+ destination: 224.0.0.0/4
+ - action: allow
+ description: Public IPv4 Internet
diff --git a/incus/acls/generated/lab.yaml b/incus/acls/generated/lab.yaml
new file mode 100644
index 0000000..32cdcea
--- /dev/null
+++ b/incus/acls/generated/lab.yaml
@@ -0,0 +1,7 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM generated egress policy: lab'
+config: {}
+ingress: []
+egress:
+ - action: allow
+ description: Experimental lab egress
diff --git a/incus/acls/generated/offline.yaml b/incus/acls/generated/offline.yaml
new file mode 100644
index 0000000..63de650
--- /dev/null
+++ b/incus/acls/generated/offline.yaml
@@ -0,0 +1,5 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM generated egress policy: offline'
+config: {}
+ingress: []
+egress: []
diff --git a/incus/acls/generated/release.yaml b/incus/acls/generated/release.yaml
new file mode 100644
index 0000000..edbd57a
--- /dev/null
+++ b/incus/acls/generated/release.yaml
@@ -0,0 +1,25 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM generated egress policy: release'
+config: {}
+ingress: []
+egress:
+ - action: allow
+ description: Runtime DNS
+ destination: 10.248.18.1/32
+ protocol: udp
+ destination_port: '53'
+ - action: allow
+ description: Runtime DNS over TCP
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '53'
+ - action: allow
+ description: Capability gateway
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '443'
+ - action: allow
+ description: Release HTTP CONNECT proxy
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '3129'
diff --git a/incus/acls/generated/restricted.yaml b/incus/acls/generated/restricted.yaml
new file mode 100644
index 0000000..50ac032
--- /dev/null
+++ b/incus/acls/generated/restricted.yaml
@@ -0,0 +1,25 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM generated egress policy: restricted'
+config: {}
+ingress: []
+egress:
+ - action: allow
+ description: Runtime DNS
+ destination: 10.248.18.1/32
+ protocol: udp
+ destination_port: '53'
+ - action: allow
+ description: Runtime DNS over TCP
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '53'
+ - action: allow
+ description: Capability gateway
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '443'
+ - action: allow
+ description: Restricted HTTP CONNECT proxy
+ destination: 10.248.18.1/32
+ protocol: tcp
+ destination_port: '3128'
diff --git a/incus/acls/vdm-agent-runtime.yaml b/incus/acls/vdm-agent-runtime.yaml
deleted file mode 100644
index 86f3368..0000000
--- a/incus/acls/vdm-agent-runtime.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-description: Baseline runtime ACL; strict egress must be enforced by the company gateway or firewall
-config: {}
-ingress: []
-egress:
- - action: allow
- description: Transitional allow rule; replace with gateway-only destinations before production
diff --git a/incus/acls/vdm-build.yaml b/incus/acls/vdm-build.yaml
new file mode 100644
index 0000000..98f1536
--- /dev/null
+++ b/incus/acls/vdm-build.yaml
@@ -0,0 +1,37 @@
+description: Public build egress with host, private, metadata, and management networks denied
+config: {}
+ingress: []
+egress:
+ - action: allow
+ description: Build bridge DNS
+ destination: 10.248.17.1/32
+ protocol: udp
+ destination_port: "53"
+ - action: allow
+ description: Build bridge DNS over TCP
+ destination: 10.248.17.1/32
+ protocol: tcp
+ destination_port: "53"
+ - action: reject
+ description: Deny private or special-use IPv4
+ destination: 10.0.0.0/8
+ - action: reject
+ description: Deny carrier-grade NAT
+ destination: 100.64.0.0/10
+ - action: reject
+ description: Deny loopback
+ destination: 127.0.0.0/8
+ - action: reject
+ description: Deny link-local and metadata
+ destination: 169.254.0.0/16
+ - action: reject
+ description: Deny private IPv4
+ destination: 172.16.0.0/12
+ - action: reject
+ description: Deny private IPv4
+ destination: 192.168.0.0/16
+ - action: reject
+ description: Deny multicast and reserved IPv4
+ destination: 224.0.0.0/4
+ - action: allow
+ description: Public IPv4 package sources
diff --git a/incus/profiles/base.yaml b/incus/profiles/base.yaml
deleted file mode 100644
index 13370ae..0000000
--- a/incus/profiles/base.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-description: General OpenCode VM
-config:
- limits.cpu: "4"
- limits.memory: 8GiB
- security.secureboot: "true"
- user.vdm.variant: base
-devices:
- root:
- type: disk
- path: /
- pool: default
- size: 80GiB
- eth0:
- type: nic
- name: eth0
- network: vdm-agentbr0
- security.acls: vdm-agent-runtime
- security.acls.default.ingress.action: reject
- security.acls.default.egress.action: allow
diff --git a/incus/profiles/cpp.yaml b/incus/profiles/cpp.yaml
deleted file mode 100644
index 7f6ce5f..0000000
--- a/incus/profiles/cpp.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-description: C and C++ OpenCode VM
-config:
- limits.cpu: "12"
- limits.memory: 24GiB
- security.secureboot: "true"
- user.vdm.variant: cpp
-devices:
- root:
- type: disk
- path: /
- pool: default
- size: 140GiB
- eth0:
- type: nic
- name: eth0
- network: vdm-agentbr0
- security.acls: vdm-agent-runtime
- security.acls.default.ingress.action: reject
- security.acls.default.egress.action: allow
diff --git a/incus/profiles/full.yaml b/incus/profiles/full.yaml
deleted file mode 100644
index 554c17a..0000000
--- a/incus/profiles/full.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-description: Mixed-language OpenCode VM
-config:
- limits.cpu: "16"
- limits.memory: 32GiB
- security.secureboot: "true"
- user.vdm.variant: full
-devices:
- root:
- type: disk
- path: /
- pool: default
- size: 200GiB
- eth0:
- type: nic
- name: eth0
- network: vdm-agentbr0
- security.acls: vdm-agent-runtime
- security.acls.default.ingress.action: reject
- security.acls.default.egress.action: allow
diff --git a/incus/profiles/generated/images/base.yaml b/incus/profiles/generated/images/base.yaml
new file mode 100644
index 0000000..d4c2538
--- /dev/null
+++ b/incus/profiles/generated/images/base.yaml
@@ -0,0 +1,6 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: General repository analysis, shell work, and documentation.
+config:
+ security.secureboot: 'true'
+ user.vdm.variant: base
+devices: {}
diff --git a/incus/profiles/generated/images/cpp.yaml b/incus/profiles/generated/images/cpp.yaml
new file mode 100644
index 0000000..120f997
--- /dev/null
+++ b/incus/profiles/generated/images/cpp.yaml
@@ -0,0 +1,6 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: Native C and C++ systems, graphics, and Linux tooling.
+config:
+ security.secureboot: 'true'
+ user.vdm.variant: cpp
+devices: {}
diff --git a/incus/profiles/generated/images/full.yaml b/incus/profiles/generated/images/full.yaml
new file mode 100644
index 0000000..271a07d
--- /dev/null
+++ b/incus/profiles/generated/images/full.yaml
@@ -0,0 +1,6 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: Mixed-language platform engineering.
+config:
+ security.secureboot: 'true'
+ user.vdm.variant: full
+devices: {}
diff --git a/incus/profiles/generated/images/php.yaml b/incus/profiles/generated/images/php.yaml
new file mode 100644
index 0000000..d194f95
--- /dev/null
+++ b/incus/profiles/generated/images/php.yaml
@@ -0,0 +1,6 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: Joomla, JCB, PHP, TypeScript, database, and browser work.
+config:
+ security.secureboot: 'true'
+ user.vdm.variant: php
+devices: {}
diff --git a/incus/profiles/generated/images/python.yaml b/incus/profiles/generated/images/python.yaml
new file mode 100644
index 0000000..8271225
--- /dev/null
+++ b/incus/profiles/generated/images/python.yaml
@@ -0,0 +1,6 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: Python services, MCP servers, automation, and data tooling.
+config:
+ security.secureboot: 'true'
+ user.vdm.variant: python
+devices: {}
diff --git a/incus/profiles/generated/images/typescript.yaml b/incus/profiles/generated/images/typescript.yaml
new file mode 100644
index 0000000..aa8f35b
--- /dev/null
+++ b/incus/profiles/generated/images/typescript.yaml
@@ -0,0 +1,6 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: Node.js, TypeScript, frontend, and browser automation.
+config:
+ security.secureboot: 'true'
+ user.vdm.variant: typescript
+devices: {}
diff --git a/incus/profiles/generated/policies/brokered.yaml b/incus/profiles/generated/policies/brokered.yaml
new file mode 100644
index 0000000..31b9a56
--- /dev/null
+++ b/incus/profiles/generated/policies/brokered.yaml
@@ -0,0 +1,14 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM network policy: brokered'
+config:
+ user.vdm.policy: brokered
+ user.vdm.policy.status: blocked
+devices:
+ eth0:
+ type: nic
+ name: eth0
+ network: vdm-agentbr0
+ security.acls: vdm-agent-brokered
+ security.acls.default.ingress.action: reject
+ security.acls.default.egress.action: reject
+ security.ipv4_filtering: 'true'
diff --git a/incus/profiles/generated/policies/connected.yaml b/incus/profiles/generated/policies/connected.yaml
new file mode 100644
index 0000000..40ff690
--- /dev/null
+++ b/incus/profiles/generated/policies/connected.yaml
@@ -0,0 +1,14 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM network policy: connected'
+config:
+ user.vdm.policy: connected
+ user.vdm.policy.status: ready
+devices:
+ eth0:
+ type: nic
+ name: eth0
+ network: vdm-agentbr0
+ security.acls: vdm-agent-connected
+ security.acls.default.ingress.action: reject
+ security.acls.default.egress.action: reject
+ security.ipv4_filtering: 'true'
diff --git a/incus/profiles/generated/policies/lab.yaml b/incus/profiles/generated/policies/lab.yaml
new file mode 100644
index 0000000..9043028
--- /dev/null
+++ b/incus/profiles/generated/policies/lab.yaml
@@ -0,0 +1,14 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM network policy: lab'
+config:
+ user.vdm.policy: lab
+ user.vdm.policy.status: experimental
+devices:
+ eth0:
+ type: nic
+ name: eth0
+ network: vdm-agentbr0
+ security.acls: vdm-agent-lab
+ security.acls.default.ingress.action: reject
+ security.acls.default.egress.action: reject
+ security.ipv4_filtering: 'true'
diff --git a/incus/profiles/generated/policies/offline.yaml b/incus/profiles/generated/policies/offline.yaml
new file mode 100644
index 0000000..f71445d
--- /dev/null
+++ b/incus/profiles/generated/policies/offline.yaml
@@ -0,0 +1,14 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM network policy: offline'
+config:
+ user.vdm.policy: offline
+ user.vdm.policy.status: ready
+devices:
+ eth0:
+ type: nic
+ name: eth0
+ network: vdm-agentbr0
+ security.acls: vdm-agent-offline
+ security.acls.default.ingress.action: reject
+ security.acls.default.egress.action: reject
+ security.ipv4_filtering: 'true'
diff --git a/incus/profiles/generated/policies/release.yaml b/incus/profiles/generated/policies/release.yaml
new file mode 100644
index 0000000..ea9c36d
--- /dev/null
+++ b/incus/profiles/generated/policies/release.yaml
@@ -0,0 +1,14 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM network policy: release'
+config:
+ user.vdm.policy: release
+ user.vdm.policy.status: blocked
+devices:
+ eth0:
+ type: nic
+ name: eth0
+ network: vdm-agentbr0
+ security.acls: vdm-agent-release
+ security.acls.default.ingress.action: reject
+ security.acls.default.egress.action: reject
+ security.ipv4_filtering: 'true'
diff --git a/incus/profiles/generated/policies/restricted.yaml b/incus/profiles/generated/policies/restricted.yaml
new file mode 100644
index 0000000..2f39dc3
--- /dev/null
+++ b/incus/profiles/generated/policies/restricted.yaml
@@ -0,0 +1,14 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM network policy: restricted'
+config:
+ user.vdm.policy: restricted
+ user.vdm.policy.status: blocked
+devices:
+ eth0:
+ type: nic
+ name: eth0
+ network: vdm-agentbr0
+ security.acls: vdm-agent-restricted
+ security.acls.default.ingress.action: reject
+ security.acls.default.egress.action: reject
+ security.ipv4_filtering: 'true'
diff --git a/incus/profiles/generated/sizes/builder.yaml b/incus/profiles/generated/sizes/builder.yaml
new file mode 100644
index 0000000..d312328
--- /dev/null
+++ b/incus/profiles/generated/sizes/builder.yaml
@@ -0,0 +1,11 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM resource class: builder'
+config:
+ limits.cpu: '24'
+ limits.memory: 64GiB
+devices:
+ root:
+ type: disk
+ path: /
+ pool: default
+ size: 500GiB
diff --git a/incus/profiles/generated/sizes/large.yaml b/incus/profiles/generated/sizes/large.yaml
new file mode 100644
index 0000000..2aa08ff
--- /dev/null
+++ b/incus/profiles/generated/sizes/large.yaml
@@ -0,0 +1,11 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM resource class: large'
+config:
+ limits.cpu: '12'
+ limits.memory: 24GiB
+devices:
+ root:
+ type: disk
+ path: /
+ pool: default
+ size: 160GiB
diff --git a/incus/profiles/generated/sizes/medium.yaml b/incus/profiles/generated/sizes/medium.yaml
new file mode 100644
index 0000000..405bdc5
--- /dev/null
+++ b/incus/profiles/generated/sizes/medium.yaml
@@ -0,0 +1,11 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM resource class: medium'
+config:
+ limits.cpu: '6'
+ limits.memory: 12GiB
+devices:
+ root:
+ type: disk
+ path: /
+ pool: default
+ size: 100GiB
diff --git a/incus/profiles/generated/sizes/small.yaml b/incus/profiles/generated/sizes/small.yaml
new file mode 100644
index 0000000..4f557ce
--- /dev/null
+++ b/incus/profiles/generated/sizes/small.yaml
@@ -0,0 +1,11 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM resource class: small'
+config:
+ limits.cpu: '4'
+ limits.memory: 8GiB
+devices:
+ root:
+ type: disk
+ path: /
+ pool: default
+ size: 80GiB
diff --git a/incus/profiles/generated/sizes/standard.yaml b/incus/profiles/generated/sizes/standard.yaml
new file mode 100644
index 0000000..5e053fc
--- /dev/null
+++ b/incus/profiles/generated/sizes/standard.yaml
@@ -0,0 +1,11 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM resource class: standard'
+config:
+ limits.cpu: '8'
+ limits.memory: 16GiB
+devices:
+ root:
+ type: disk
+ path: /
+ pool: default
+ size: 120GiB
diff --git a/incus/profiles/generated/sizes/tiny.yaml b/incus/profiles/generated/sizes/tiny.yaml
new file mode 100644
index 0000000..e6eb53c
--- /dev/null
+++ b/incus/profiles/generated/sizes/tiny.yaml
@@ -0,0 +1,11 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM resource class: tiny'
+config:
+ limits.cpu: '2'
+ limits.memory: 4GiB
+devices:
+ root:
+ type: disk
+ path: /
+ pool: default
+ size: 40GiB
diff --git a/incus/profiles/generated/sizes/xlarge.yaml b/incus/profiles/generated/sizes/xlarge.yaml
new file mode 100644
index 0000000..7c8bc84
--- /dev/null
+++ b/incus/profiles/generated/sizes/xlarge.yaml
@@ -0,0 +1,11 @@
+# Generated from manifest/images.yaml. Do not edit.
+description: 'VDM resource class: xlarge'
+config:
+ limits.cpu: '16'
+ limits.memory: 32GiB
+devices:
+ root:
+ type: disk
+ path: /
+ pool: default
+ size: 240GiB
diff --git a/incus/profiles/php.yaml b/incus/profiles/php.yaml
deleted file mode 100644
index 38561c7..0000000
--- a/incus/profiles/php.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-description: PHP, Joomla and JCB OpenCode VM
-config:
- limits.cpu: "8"
- limits.memory: 16GiB
- security.secureboot: "true"
- user.vdm.variant: php
-devices:
- root:
- type: disk
- path: /
- pool: default
- size: 120GiB
- eth0:
- type: nic
- name: eth0
- network: vdm-agentbr0
- security.acls: vdm-agent-runtime
- security.acls.default.ingress.action: reject
- security.acls.default.egress.action: allow
diff --git a/incus/profiles/python.yaml b/incus/profiles/python.yaml
deleted file mode 100644
index f18c156..0000000
--- a/incus/profiles/python.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-description: Python and MCP OpenCode VM
-config:
- limits.cpu: "8"
- limits.memory: 16GiB
- security.secureboot: "true"
- user.vdm.variant: python
-devices:
- root:
- type: disk
- path: /
- pool: default
- size: 100GiB
- eth0:
- type: nic
- name: eth0
- network: vdm-agentbr0
- security.acls: vdm-agent-runtime
- security.acls.default.ingress.action: reject
- security.acls.default.egress.action: allow
diff --git a/incus/profiles/typescript.yaml b/incus/profiles/typescript.yaml
deleted file mode 100644
index 9500078..0000000
--- a/incus/profiles/typescript.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-description: TypeScript and browser OpenCode VM
-config:
- limits.cpu: "8"
- limits.memory: 16GiB
- security.secureboot: "true"
- user.vdm.variant: typescript
-devices:
- root:
- type: disk
- path: /
- pool: default
- size: 120GiB
- eth0:
- type: nic
- name: eth0
- network: vdm-agentbr0
- security.acls: vdm-agent-runtime
- security.acls.default.ingress.action: reject
- security.acls.default.egress.action: allow
diff --git a/incus/projects/vdm-agents.yaml b/incus/projects/vdm-agents.yaml
index c13dedc..03f8445 100644
--- a/incus/projects/vdm-agents.yaml
+++ b/incus/projects/vdm-agents.yaml
@@ -4,3 +4,16 @@ config:
features.networks: "true"
features.profiles: "true"
features.storage.volumes: "true"
+ restricted: "true"
+ restricted.devices.disk: managed
+ restricted.devices.nic: managed
+ restricted.networks.access: vdm-buildbr0,vdm-agentbr0
+ restricted.devices.gpu: block
+ restricted.devices.infiniband: block
+ restricted.devices.pci: block
+ restricted.devices.proxy: block
+ restricted.devices.unix-block: block
+ restricted.devices.unix-char: block
+ restricted.devices.unix-hotplug: block
+ restricted.devices.usb: block
+ restricted.virtual-machines.lowlevel: block
diff --git a/manifest/generated/platform.env b/manifest/generated/platform.env
new file mode 100644
index 0000000..7585216
--- /dev/null
+++ b/manifest/generated/platform.env
@@ -0,0 +1,72 @@
+# Generated from manifest/images.yaml. Do not edit.
+PLATFORM_NAME=vdm-opencode-platform
+PLATFORM_VERSION=0.3.0-rc.1
+INCUS_BASE_IMAGE=images:ubuntu/24.04/cloud
+INCUS_IMAGE_PREFIX=vdm-opencode
+PLATFORM_IMAGES=(base php python cpp typescript full)
+PLATFORM_RELEASE_IMAGES=(base php python cpp typescript full)
+PLATFORM_RELEASE_ARCHITECTURES=(amd64)
+
+declare -Ag PLATFORM_ARCH_ALIASES=(
+ [x86_64]=amd64
+ [amd64]=amd64
+ [aarch64]=arm64
+ [arm64]=arm64
+)
+
+declare -Ag PLATFORM_IMAGE_COMPONENTS=(
+ [base]=shell
+ [php]='shell php node typescript browser database'
+ [python]='shell python'
+ [cpp]='shell native'
+ [typescript]='shell node typescript browser'
+ [full]='shell php python node typescript native browser database'
+)
+
+declare -Ag PLATFORM_IMAGE_DEFAULT_POLICY=(
+ [base]=connected
+ [php]=connected
+ [python]=connected
+ [cpp]=connected
+ [typescript]=connected
+ [full]=connected
+)
+
+declare -Ag PLATFORM_IMAGE_DEFAULT_SIZE=(
+ [base]=small
+ [php]=standard
+ [python]=standard
+ [cpp]=large
+ [typescript]=standard
+ [full]=xlarge
+)
+
+declare -Ag PLATFORM_COMPONENT_PROVISION=(
+ [shell]=''
+ [php]=php.sh
+ [python]=python.sh
+ [node]=''
+ [typescript]=typescript.sh
+ [native]=cpp.sh
+ [browser]=browser.sh
+ [database]=database.sh
+)
+
+declare -Ag PLATFORM_POLICY_STATUS=(
+ [offline]=ready
+ [brokered]=blocked
+ [restricted]=blocked
+ [connected]=ready
+ [release]=blocked
+ [lab]=experimental
+)
+
+declare -Ag PLATFORM_SIZE_CPUS=(
+ [tiny]=2
+ [small]=4
+ [medium]=6
+ [standard]=8
+ [large]=12
+ [xlarge]=16
+ [builder]=24
+)
diff --git a/manifest/images.yaml b/manifest/images.yaml
index 0d60906..9861a2f 100644
--- a/manifest/images.yaml
+++ b/manifest/images.yaml
@@ -1,47 +1,222 @@
-schema: 1
-platform: vdm-opencode-platform
-version: 0.1.0
-base_image: images:ubuntu/24.04/cloud
-variants:
+schema: 2
+
+platform:
+ name: vdm-opencode-platform
+ version: 0.3.0-rc.1
+ image_prefix: vdm-opencode
+ base_image: images:ubuntu/24.04/cloud
+ architectures:
+ amd64:
+ aliases: [x86_64, amd64]
+ release: true
+ arm64:
+ aliases: [aarch64, arm64]
+ release: false
+ license: GPL-3.0-only
+ copyright:
+ holder: Vast Development Method
+ year: 2026
+
+components:
+ shell: {status: ready, provision: null}
+ php: {status: ready, provision: php.sh}
+ python: {status: ready, provision: python.sh}
+ node: {status: ready, provision: null}
+ typescript: {status: ready, provision: typescript.sh}
+ native: {status: ready, provision: cpp.sh}
+ browser: {status: ready, provision: browser.sh}
+ database: {status: ready, provision: database.sh}
+ android: {status: planned, provision: android.sh}
+ gpu: {status: planned, provision: null}
+ containers: {status: planned, provision: containers.sh}
+ gui: {status: planned, provision: gui.sh}
+ audio: {status: planned, provision: audio.sh}
+ security: {status: planned, provision: security.sh}
+
+dimensions:
+ languages:
+ shell:
+ label: Bash and POSIX shell
+ status: ready
+ requires: []
+ components: [shell]
+ php:
+ label: PHP
+ status: ready
+ requires: [shell]
+ components: [php]
+ python:
+ label: Python
+ status: ready
+ requires: [shell]
+ components: [python]
+ node:
+ label: Node.js
+ status: ready
+ requires: [shell]
+ components: [node]
+ typescript:
+ label: TypeScript
+ status: ready
+ requires: [node]
+ components: [typescript]
+ c:
+ label: C
+ status: ready
+ requires: [shell]
+ components: [native]
+ cpp:
+ label: C++
+ status: ready
+ requires: [c]
+ components: [native]
+
+ capabilities:
+ cpu:
+ label: CPU execution
+ phase: runtime
+ status: ready
+ components: []
+ browser:
+ label: Chromium and Playwright
+ phase: build
+ status: ready
+ components: [browser]
+ database:
+ label: Database clients
+ phase: build
+ status: ready
+ components: [database]
+ android:
+ label: Android SDK and device tooling
+ phase: build
+ status: planned
+ components: [android]
+ gpu:
+ label: GPU acceleration
+ phase: runtime
+ status: planned
+ components: [gpu]
+ containers:
+ label: Rootless container tooling
+ phase: both
+ status: planned
+ components: [containers]
+ gui:
+ label: Graphical application testing
+ phase: both
+ status: planned
+ components: [gui]
+ audio:
+ label: Audio capture and processing
+ phase: both
+ status: planned
+ components: [audio]
+ security:
+ label: Security analysis tooling
+ phase: build
+ status: planned
+ components: [security]
+
+ policies:
+ offline:
+ label: No network
+ status: ready
+ ingress: reject
+ egress: reject
+ credentials: none
+ require_gateway: false
+ brokered:
+ label: Broker-only network
+ status: blocked
+ ingress: reject
+ egress: reject
+ credentials: brokered
+ require_gateway: true
+ restricted:
+ label: Allowlisted network
+ status: blocked
+ ingress: reject
+ egress: reject
+ credentials: scoped
+ require_gateway: true
+ connected:
+ label: Public Internet with private networks denied
+ status: ready
+ ingress: reject
+ egress: allow
+ credentials: session
+ require_gateway: false
+ release:
+ label: Release publishing
+ status: blocked
+ ingress: reject
+ egress: reject
+ credentials: release
+ require_gateway: true
+ lab:
+ label: Privileged hardware lab
+ status: experimental
+ ingress: reject
+ egress: allow
+ credentials: none
+ require_gateway: false
+
+ sizes:
+ tiny: {cpus: 2, memory: 4GiB, disk: 40GiB}
+ small: {cpus: 4, memory: 8GiB, disk: 80GiB}
+ medium: {cpus: 6, memory: 12GiB, disk: 100GiB}
+ standard: {cpus: 8, memory: 16GiB, disk: 120GiB}
+ large: {cpus: 12, memory: 24GiB, disk: 160GiB}
+ xlarge: {cpus: 16, memory: 32GiB, disk: 240GiB}
+ builder: {cpus: 24, memory: 64GiB, disk: 500GiB}
+
+images:
base:
- alias: vdm-opencode-base
- cpus: 4
- memory: 8GiB
- disk: 80GiB
- purpose: General repository analysis and documentation.
- browser_mcp: false
+ purpose: General repository analysis, shell work, and documentation.
+ status: ready
+ release: true
+ languages: [shell]
+ capabilities: [cpu]
+ default_policy: connected
+ default_size: small
php:
- alias: vdm-opencode-php
- cpus: 8
- memory: 16GiB
- disk: 120GiB
- purpose: Joomla, JCB, PHP and Composer projects.
- browser_mcp: true
+ purpose: Joomla, JCB, PHP, TypeScript, database, and browser work.
+ status: ready
+ release: true
+ languages: [shell, php, node, typescript]
+ capabilities: [cpu, browser, database]
+ default_policy: connected
+ default_size: standard
python:
- alias: vdm-opencode-python
- cpus: 8
- memory: 16GiB
- disk: 100GiB
- purpose: Python services, MCP servers and automation.
- browser_mcp: false
+ purpose: Python services, MCP servers, automation, and data tooling.
+ status: ready
+ release: true
+ languages: [shell, python]
+ capabilities: [cpu]
+ default_policy: connected
+ default_size: standard
cpp:
- alias: vdm-opencode-cpp
- cpus: 12
- memory: 24GiB
- disk: 140GiB
- purpose: Native C and C++ systems, graphics and Linux tooling.
- browser_mcp: false
+ purpose: Native C and C++ systems, graphics, and Linux tooling.
+ status: ready
+ release: true
+ languages: [shell, c, cpp]
+ capabilities: [cpu]
+ default_policy: connected
+ default_size: large
typescript:
- alias: vdm-opencode-typescript
- cpus: 8
- memory: 16GiB
- disk: 120GiB
- purpose: TypeScript, Node.js, frontend and browser testing.
- browser_mcp: true
+ purpose: Node.js, TypeScript, frontend, and browser automation.
+ status: ready
+ release: true
+ languages: [shell, node, typescript]
+ capabilities: [cpu, browser]
+ default_policy: connected
+ default_size: standard
full:
- alias: vdm-opencode-full
- cpus: 16
- memory: 32GiB
- disk: 200GiB
purpose: Mixed-language platform engineering.
- browser_mcp: true
+ status: ready
+ release: true
+ languages: [shell, php, python, node, typescript, c, cpp]
+ capabilities: [cpu, browser, database]
+ default_policy: connected
+ default_size: xlarge
diff --git a/manifest/mcp-catalog.yaml b/manifest/mcp-catalog.yaml
old mode 100755
new mode 100644
diff --git a/manifest/platform.env b/manifest/platform.env
old mode 100755
new mode 100644
index 44efae7..389f153
--- a/manifest/platform.env
+++ b/manifest/platform.env
@@ -1,13 +1,7 @@
-PLATFORM_NAME="${PLATFORM_NAME:-vdm-opencode-platform}"
-PLATFORM_VERSION="${PLATFORM_VERSION:-0.2.0}"
-
INCUS_PROJECT="${INCUS_PROJECT:-vdm-agents}"
INCUS_BUILD_NETWORK="${INCUS_BUILD_NETWORK:-vdm-buildbr0}"
INCUS_RUNTIME_NETWORK="${INCUS_RUNTIME_NETWORK:-vdm-agentbr0}"
-INCUS_RUNTIME_ACL="${INCUS_RUNTIME_ACL:-vdm-agent-runtime}"
-INCUS_BASE_IMAGE="${INCUS_BASE_IMAGE:-images:ubuntu/24.04/cloud}"
-INCUS_IMAGE_PREFIX="${INCUS_IMAGE_PREFIX:-vdm-opencode}"
INCUS_STORAGE_POOL="${INCUS_STORAGE_POOL:-}"
INCUS_DEFAULT_ROOT_SIZE="${INCUS_DEFAULT_ROOT_SIZE:-80GiB}"
diff --git a/manifest/sources.lock.yaml b/manifest/sources.lock.yaml
old mode 100755
new mode 100644
diff --git a/manifest/toolchain.env b/manifest/toolchain.env
old mode 100755
new mode 100644
index 0572019..9448102
--- a/manifest/toolchain.env
+++ b/manifest/toolchain.env
@@ -1,13 +1,13 @@
-# Approved package versions for platform release 0.2.0.
+# Approved package versions for platform release 0.3.0-rc.1.
# Update these values deliberately and validate every image before promotion.
OPENCODE_PACKAGE=opencode-ai@1.18.4
OPENCODE_EXPECTED_VERSION=1.18.4
NODE_MAJOR=22
+NODESOURCE_SETUP_SHA256=575583bbac2fccc0b5edd0dbc03e222d9f9dc8d724da996d22754d6411104fd1
PHP_MAJOR=8.3
PYTHON_MAJOR=3.12
-JAVA_MAJOR=21
GIT_MCP_PACKAGE=mcp-server-git==2026.7.10
GIT_MCP_EXPECTED_VERSION=2026.7.10
diff --git a/scripts/apply-incus.sh b/scripts/apply-incus.sh
index e09157a..9e6eb81 100755
--- a/scripts/apply-incus.sh
+++ b/scripts/apply-incus.sh
@@ -24,23 +24,46 @@ apply_network() {
apply_network "$INCUS_BUILD_NETWORK" "$ROOT_DIR/incus/networks/vdm-buildbr0.yaml"
apply_network "$INCUS_RUNTIME_NETWORK" "$ROOT_DIR/incus/networks/vdm-agentbr0.yaml"
-if ! project_cmd network acl show "$INCUS_RUNTIME_ACL" >/dev/null 2>&1; then
- project_cmd network acl create "$INCUS_RUNTIME_ACL"
-fi
-project_cmd network acl edit "$INCUS_RUNTIME_ACL" < "$ROOT_DIR/incus/acls/vdm-agent-runtime.yaml"
+apply_acl() {
+ local name="$1"
+ local file="$2"
+ if ! project_cmd network acl show "$name" >/dev/null 2>&1; then
+ project_cmd network acl create "$name"
+ fi
+ project_cmd network acl edit "$name" < "$file"
+}
-for variant in base php python cpp typescript full; do
- profile="vdm-opencode-${variant}"
+apply_acl vdm-build "$ROOT_DIR/incus/acls/vdm-build.yaml"
+for policy_file in "$ROOT_DIR"/incus/acls/generated/*.yaml; do
+ policy="$(basename "$policy_file" .yaml)"
+ apply_acl "vdm-agent-$policy" "$policy_file"
+done
+
+apply_profile() {
+ local profile="$1"
+ local profile_file="$2"
if ! project_cmd profile show "$profile" >/dev/null 2>&1; then
project_cmd profile create "$profile"
fi
- profile_file="$ROOT_DIR/incus/profiles/${variant}.yaml"
if [ -n "${INCUS_STORAGE_POOL:-}" ]; then
sed "s/pool: default/pool: ${INCUS_STORAGE_POOL}/" "$profile_file" | project_cmd profile edit "$profile"
else
project_cmd profile edit "$profile" < "$profile_file"
fi
+}
+
+for profile_file in "$ROOT_DIR"/incus/profiles/generated/images/*.yaml; do
+ name="$(basename "$profile_file" .yaml)"
+ apply_profile "vdm-opencode-$name" "$profile_file"
+done
+for profile_file in "$ROOT_DIR"/incus/profiles/generated/sizes/*.yaml; do
+ name="$(basename "$profile_file" .yaml)"
+ apply_profile "vdm-size-$name" "$profile_file"
+done
+for profile_file in "$ROOT_DIR"/incus/profiles/generated/policies/*.yaml; do
+ name="$(basename "$profile_file" .yaml)"
+ apply_profile "vdm-policy-$name" "$profile_file"
done
log "Incus project definition applied"
diff --git a/scripts/bootstrap-host.sh b/scripts/bootstrap-host.sh
index cba4578..c4f76bc 100755
--- a/scripts/bootstrap-host.sh
+++ b/scripts/bootstrap-host.sh
@@ -19,6 +19,8 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl \
incus \
jq \
+ python3-yaml \
+ qemu-system \
shellcheck \
yamllint \
zstd
@@ -35,4 +37,5 @@ if ! incus_cmd remote list --format csv | cut -d, -f1 | grep -qx images; then
fi
"$SCRIPT_DIR/apply-incus.sh"
+"$SCRIPT_DIR/install-host-units.sh"
log "Host bootstrap complete"
diff --git a/scripts/build-all-images.sh b/scripts/build-all-images.sh
index d3cbbe4..daf6b94 100755
--- a/scripts/build-all-images.sh
+++ b/scripts/build-all-images.sh
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -Eeuo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
-for variant in base php python cpp typescript full; do
+# shellcheck disable=SC1091
+source "$SCRIPT_DIR/lib/common.sh"
+for variant in "${PLATFORM_RELEASE_IMAGES[@]}"; do
"$SCRIPT_DIR/build-image.sh" "$variant"
done
diff --git a/scripts/build-image.sh b/scripts/build-image.sh
index ab20518..847fabb 100755
--- a/scripts/build-image.sh
+++ b/scripts/build-image.sh
@@ -5,7 +5,7 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/common.sh"
VARIANT="${1:-}"
-variant_exists "$VARIANT" || die "Variant must be one of: base php python cpp typescript full"
+variant_exists "$VARIANT" || die "Variant must be one of: ${PLATFORM_IMAGES[*]}"
"$SCRIPT_DIR/apply-incus.sh"
@@ -18,10 +18,19 @@ cleanup() {
trap cleanup EXIT
log "Creating build VM $BUILD_NAME"
-project_cmd init "$INCUS_BASE_IMAGE" "$BUILD_NAME" --vm --profile "vdm-opencode-${VARIANT}"
+project_cmd init "$INCUS_BASE_IMAGE" "$BUILD_NAME" --vm \
+ --profile "vdm-opencode-${VARIANT}" \
+ --profile "vdm-size-${PLATFORM_IMAGE_DEFAULT_SIZE[$VARIANT]}" \
+ --profile "vdm-policy-${PLATFORM_IMAGE_DEFAULT_POLICY[$VARIANT]}"
# Builders need the broader build network. Replace the profile NIC for this temporary VM.
-project_cmd config device override "$BUILD_NAME" eth0 network="$INCUS_BUILD_NETWORK" name=eth0
+project_cmd config device override "$BUILD_NAME" eth0 \
+ network="$INCUS_BUILD_NETWORK" \
+ name=eth0 \
+ security.acls=vdm-build \
+ security.acls.default.ingress.action=reject \
+ security.acls.default.egress.action=reject \
+ security.ipv4_filtering=true
project_cmd start "$BUILD_NAME"
wait_for_vm "$BUILD_NAME" || die "VM agent did not become ready: $BUILD_NAME"
@@ -33,6 +42,7 @@ tar -C "$ROOT_DIR/image/provision" -cf - . | project_cmd exec "$BUILD_NAME" -- t
COMMON_ENV=(
"AGENT_USER=$AGENT_USER"
"NODE_MAJOR=$NODE_MAJOR"
+ "NODESOURCE_SETUP_SHA256=$NODESOURCE_SETUP_SHA256"
"OPENCODE_PACKAGE=$OPENCODE_PACKAGE"
"OPENCODE_EXPECTED_VERSION=$OPENCODE_EXPECTED_VERSION"
"GIT_MCP_PACKAGE=$GIT_MCP_PACKAGE"
@@ -61,16 +71,10 @@ exec_with_env() {
}
exec_with_env bash /opt/vdm-build/common.sh
-case "$VARIANT" in
- base) ;;
- php)
- exec_with_env bash /opt/vdm-build/php.sh
- exec_with_env bash /opt/vdm-build/typescript.sh
- ;;
- python|cpp|typescript|full)
- exec_with_env bash "/opt/vdm-build/${VARIANT}.sh"
- ;;
-esac
+for component in ${PLATFORM_IMAGE_COMPONENTS[$VARIANT]}; do
+ provision="${PLATFORM_COMPONENT_PROVISION[$component]:-}"
+ [[ -z "$provision" ]] || exec_with_env bash "/opt/vdm-build/$provision"
+done
project_cmd exec "$BUILD_NAME" \
--env "PLATFORM_VERSION=$PLATFORM_VERSION" \
@@ -86,5 +90,6 @@ project_cmd publish "$BUILD_NAME/sanitized" --alias "$ALIAS" --reuse
project_cmd image set-property "$ALIAS" org.vdm.platform "$PLATFORM_NAME"
project_cmd image set-property "$ALIAS" org.vdm.version "$PLATFORM_VERSION"
project_cmd image set-property "$ALIAS" org.vdm.variant "$VARIANT"
+project_cmd image set-property "$ALIAS" org.vdm.architecture "$(canonical_architecture "$(uname -m)")"
log "Published $ALIAS"
diff --git a/scripts/ci/check-architecture.sh b/scripts/ci/check-architecture.sh
new file mode 100755
index 0000000..bfb67fb
--- /dev/null
+++ b/scripts/ci/check-architecture.sh
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+# shellcheck disable=SC1091
+source "$SCRIPT_DIR/../lib/common.sh"
+
+EXPECTED="${1:?Usage: $0 amd64|arm64}"
+ACTUAL="$(canonical_architecture "$(uname -m)")"
+[ "$ACTUAL" = "$EXPECTED" ] || die "Runner architecture mismatch: expected $EXPECTED, got $ACTUAL"
diff --git a/scripts/generate-platform.py b/scripts/generate-platform.py
new file mode 100644
index 0000000..fc87cfe
--- /dev/null
+++ b/scripts/generate-platform.py
@@ -0,0 +1,455 @@
+#!/usr/bin/env python3
+"""Validate the platform manifest and render every derived authority file."""
+
+from __future__ import annotations
+
+import argparse
+import difflib
+import json
+import re
+import shlex
+import sys
+from collections.abc import Iterable, Mapping
+from pathlib import Path
+from typing import Any
+
+import yaml
+
+
+ROOT = Path(__file__).resolve().parents[1]
+MANIFEST = ROOT / "manifest/images.yaml"
+GENERATED_HEADER = "# Generated from manifest/images.yaml. Do not edit.\n"
+IDENTIFIER = re.compile(r"^[a-z][a-z0-9-]*$")
+SEMVER = re.compile(
+ r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)"
+ r"(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?"
+ r"(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$"
+)
+FORBIDDEN_LANGUAGES = {"go", "java", "rust"}
+VALID_STATUS = {"ready", "experimental", "planned", "blocked"}
+
+
+class IndentedDumper(yaml.SafeDumper):
+ """Emit block sequences indented beneath their mapping key."""
+
+ def increase_indent(self, flow: bool = False, indentless: bool = False) -> None:
+ return super().increase_indent(flow, False)
+
+
+class ManifestError(ValueError):
+ """Raised when the manifest contract is invalid."""
+
+
+def require(condition: bool, message: str) -> None:
+ if not condition:
+ raise ManifestError(message)
+
+
+def require_mapping(value: Any, path: str) -> Mapping[str, Any]:
+ require(isinstance(value, Mapping), f"{path} must be a mapping")
+ return value
+
+
+def require_identifiers(values: Iterable[str], path: str) -> None:
+ for value in values:
+ require(
+ isinstance(value, str) and IDENTIFIER.fullmatch(value) is not None,
+ f"{path}.{value!s} is not a safe identifier",
+ )
+
+
+def load_manifest() -> dict[str, Any]:
+ with MANIFEST.open("r", encoding="utf-8") as stream:
+ data = yaml.safe_load(stream)
+ require(isinstance(data, dict), "manifest root must be a mapping")
+ return data
+
+
+def validate_manifest(data: Mapping[str, Any]) -> None:
+ require(data.get("schema") == 2, "schema must be 2")
+ platform = require_mapping(data.get("platform"), "platform")
+ require(platform.get("name") == "vdm-opencode-platform", "unexpected platform name")
+ version = platform.get("version")
+ require(isinstance(version, str) and SEMVER.fullmatch(version) is not None, "invalid semantic version")
+ require(platform.get("license") == "GPL-3.0-only", "license must be GPL-3.0-only")
+ copyright_data = require_mapping(platform.get("copyright"), "platform.copyright")
+ require(copyright_data.get("holder") == "Vast Development Method", "copyright holder must be Vast Development Method")
+ require(isinstance(copyright_data.get("year"), int), "copyright year must be an integer")
+
+ architectures = require_mapping(platform.get("architectures"), "platform.architectures")
+ require({"amd64", "arm64"}.issubset(architectures), "amd64 and arm64 architectures are required")
+ require_identifiers(architectures, "platform.architectures")
+ aliases: set[str] = set()
+ for name, architecture in architectures.items():
+ architecture = require_mapping(architecture, f"platform.architectures.{name}")
+ current = architecture.get("aliases")
+ require(isinstance(current, list) and current, f"architecture {name} requires aliases")
+ for alias in current:
+ require(isinstance(alias, str) and alias not in aliases, f"duplicate architecture alias: {alias}")
+ aliases.add(alias)
+ require(isinstance(architecture.get("release"), bool), f"architecture {name}.release must be boolean")
+
+ components = require_mapping(data.get("components"), "components")
+ require_identifiers(components, "components")
+ for name, component in components.items():
+ component = require_mapping(component, f"components.{name}")
+ require(component.get("status") in VALID_STATUS, f"invalid component status: {name}")
+ provision = component.get("provision")
+ require(provision is None or (isinstance(provision, str) and "/" not in provision), f"unsafe provision script: {name}")
+
+ dimensions = require_mapping(data.get("dimensions"), "dimensions")
+ languages = require_mapping(dimensions.get("languages"), "dimensions.languages")
+ capabilities = require_mapping(dimensions.get("capabilities"), "dimensions.capabilities")
+ policies = require_mapping(dimensions.get("policies"), "dimensions.policies")
+ sizes = require_mapping(dimensions.get("sizes"), "dimensions.sizes")
+ for values, path in (
+ (languages, "dimensions.languages"),
+ (capabilities, "dimensions.capabilities"),
+ (policies, "dimensions.policies"),
+ (sizes, "dimensions.sizes"),
+ ):
+ require_identifiers(values, path)
+
+ require(not (FORBIDDEN_LANGUAGES & set(languages)), "Rust, Go, and Java language variants are intentionally unsupported")
+ require({"shell", "php", "python", "node", "typescript", "c", "cpp"}.issubset(languages), "required language catalog is incomplete")
+ require({"cpu", "browser", "database", "android", "gpu"}.issubset(capabilities), "required capability catalog is incomplete")
+ require(len(policies) >= 5, "at least five policy classes are required")
+ require(len(sizes) >= 5, "at least five size classes are required")
+
+ for name, language in languages.items():
+ language = require_mapping(language, f"dimensions.languages.{name}")
+ require(language.get("status") in VALID_STATUS, f"invalid language status: {name}")
+ dependencies = language.get("requires")
+ refs = language.get("components")
+ require(isinstance(dependencies, list), f"language {name}.requires must be a list")
+ require(isinstance(refs, list), f"language {name}.components must be a list")
+ require(all(dep in languages for dep in dependencies), f"language {name} references an unknown dependency")
+ require(all(ref in components for ref in refs), f"language {name} references an unknown component")
+
+ for name, capability in capabilities.items():
+ capability = require_mapping(capability, f"dimensions.capabilities.{name}")
+ require(capability.get("status") in VALID_STATUS, f"invalid capability status: {name}")
+ refs = capability.get("components")
+ require(isinstance(refs, list) and all(ref in components for ref in refs), f"capability {name} has invalid components")
+
+ for name, policy in policies.items():
+ policy = require_mapping(policy, f"dimensions.policies.{name}")
+ require(policy.get("status") in VALID_STATUS, f"invalid policy status: {name}")
+ require(policy.get("ingress") in {"allow", "reject"}, f"invalid ingress policy: {name}")
+ require(policy.get("egress") in {"allow", "reject"}, f"invalid egress policy: {name}")
+
+ for name, size in sizes.items():
+ size = require_mapping(size, f"dimensions.sizes.{name}")
+ require(isinstance(size.get("cpus"), int) and size["cpus"] > 0, f"invalid CPU count: {name}")
+ for field in ("memory", "disk"):
+ require(isinstance(size.get(field), str) and re.fullmatch(r"[1-9]\d*GiB", size[field]) is not None, f"invalid {field}: {name}")
+
+ images = require_mapping(data.get("images"), "images")
+ require_identifiers(images, "images")
+ require(any(image.get("release") is True for image in images.values()), "at least one release image is required")
+ for name, image in images.items():
+ image = require_mapping(image, f"images.{name}")
+ require(image.get("status") in VALID_STATUS, f"invalid image status: {name}")
+ require(isinstance(image.get("release"), bool), f"image {name}.release must be boolean")
+ image_languages = image.get("languages")
+ image_capabilities = image.get("capabilities")
+ require(isinstance(image_languages, list) and all(ref in languages for ref in image_languages), f"image {name} has invalid languages")
+ require(isinstance(image_capabilities, list) and all(ref in capabilities for ref in image_capabilities), f"image {name} has invalid capabilities")
+ require(image.get("default_policy") in policies, f"image {name} has an invalid default policy")
+ require(image.get("default_size") in sizes, f"image {name} has an invalid default size")
+ if image["release"]:
+ require(image["status"] == "ready", f"release image {name} must be ready")
+ require(all(languages[ref]["status"] == "ready" for ref in image_languages), f"release image {name} uses an unready language")
+ require(all(capabilities[ref]["status"] == "ready" for ref in image_capabilities), f"release image {name} uses an unready capability")
+ for component in resolve_components(data, image):
+ require(components[component]["status"] == "ready", f"release image {name} uses unready component {component}")
+
+
+def resolve_language_order(languages: Mapping[str, Any], requested: Iterable[str]) -> list[str]:
+ result: list[str] = []
+ state: dict[str, int] = {}
+
+ def visit(name: str) -> None:
+ marker = state.get(name, 0)
+ require(marker != 1, f"language dependency cycle includes {name}")
+ if marker == 2:
+ return
+ state[name] = 1
+ for dependency in languages[name]["requires"]:
+ visit(dependency)
+ state[name] = 2
+ result.append(name)
+
+ for language in requested:
+ visit(language)
+ return result
+
+
+def resolve_components(data: Mapping[str, Any], image: Mapping[str, Any]) -> list[str]:
+ dimensions = data["dimensions"]
+ result: list[str] = []
+ seen: set[str] = set()
+
+ def append(items: Iterable[str]) -> None:
+ for item in items:
+ if item not in seen:
+ seen.add(item)
+ result.append(item)
+
+ for language in resolve_language_order(dimensions["languages"], image["languages"]):
+ append(dimensions["languages"][language]["components"])
+ for capability in image["capabilities"]:
+ append(dimensions["capabilities"][capability]["components"])
+ return result
+
+
+def shell_array(values: Iterable[str]) -> str:
+ return "(" + " ".join(shlex.quote(value) for value in values) + ")"
+
+
+def render_shell(data: Mapping[str, Any]) -> str:
+ platform = data["platform"]
+ images = data["images"]
+ release_images = [name for name, image in images.items() if image["release"]]
+ release_architectures = [name for name, architecture in platform["architectures"].items() if architecture["release"]]
+ lines = [
+ GENERATED_HEADER.rstrip(),
+ f"PLATFORM_NAME={shlex.quote(platform['name'])}",
+ f"PLATFORM_VERSION={shlex.quote(platform['version'])}",
+ f"INCUS_BASE_IMAGE={shlex.quote(platform['base_image'])}",
+ f"INCUS_IMAGE_PREFIX={shlex.quote(platform['image_prefix'])}",
+ f"PLATFORM_IMAGES={shell_array(images)}",
+ f"PLATFORM_RELEASE_IMAGES={shell_array(release_images)}",
+ f"PLATFORM_RELEASE_ARCHITECTURES={shell_array(release_architectures)}",
+ "",
+ "declare -Ag PLATFORM_ARCH_ALIASES=(",
+ ]
+ for canonical, architecture in platform["architectures"].items():
+ for alias in architecture["aliases"]:
+ lines.append(f" [{shlex.quote(alias)}]={shlex.quote(canonical)}")
+ lines.extend([")", "", "declare -Ag PLATFORM_IMAGE_COMPONENTS=("])
+ for name, image in images.items():
+ lines.append(f" [{name}]={shlex.quote(' '.join(resolve_components(data, image)))}")
+ lines.extend([")", "", "declare -Ag PLATFORM_IMAGE_DEFAULT_POLICY=("])
+ for name, image in images.items():
+ lines.append(f" [{name}]={shlex.quote(image['default_policy'])}")
+ lines.extend([")", "", "declare -Ag PLATFORM_IMAGE_DEFAULT_SIZE=("])
+ for name, image in images.items():
+ lines.append(f" [{name}]={shlex.quote(image['default_size'])}")
+ lines.extend([")", "", "declare -Ag PLATFORM_COMPONENT_PROVISION=("])
+ for name, component in data["components"].items():
+ if component["status"] == "ready":
+ lines.append(f" [{name}]={shlex.quote(component['provision'] or '')}")
+ lines.extend([")", "", "declare -Ag PLATFORM_POLICY_STATUS=("])
+ for name, policy in data["dimensions"]["policies"].items():
+ lines.append(f" [{name}]={shlex.quote(policy['status'])}")
+ lines.extend([")", "", "declare -Ag PLATFORM_SIZE_CPUS=("])
+ for name, size in data["dimensions"]["sizes"].items():
+ lines.append(f" [{name}]={shlex.quote(str(size['cpus']))}")
+ lines.extend([")", ""])
+ return "\n".join(lines)
+
+
+def yaml_text(value: Mapping[str, Any]) -> str:
+ return GENERATED_HEADER + yaml.dump(
+ value,
+ Dumper=IndentedDumper,
+ sort_keys=False,
+ default_flow_style=False,
+ )
+
+
+def image_profile(name: str, image: Mapping[str, Any]) -> str:
+ return yaml_text(
+ {
+ "description": image["purpose"],
+ "config": {
+ "security.secureboot": "true",
+ "user.vdm.variant": name,
+ },
+ "devices": {},
+ }
+ )
+
+
+def size_profile(name: str, size: Mapping[str, Any]) -> str:
+ return yaml_text(
+ {
+ "description": f"VDM resource class: {name}",
+ "config": {
+ "limits.cpu": str(size["cpus"]),
+ "limits.memory": size["memory"],
+ },
+ "devices": {
+ "root": {
+ "type": "disk",
+ "path": "/",
+ "pool": "default",
+ "size": size["disk"],
+ }
+ },
+ }
+ )
+
+
+def policy_profile(name: str, policy: Mapping[str, Any]) -> str:
+ return yaml_text(
+ {
+ "description": f"VDM network policy: {name}",
+ "config": {
+ "user.vdm.policy": name,
+ "user.vdm.policy.status": policy["status"],
+ },
+ "devices": {
+ "eth0": {
+ "type": "nic",
+ "name": "eth0",
+ "network": "vdm-agentbr0",
+ "security.acls": f"vdm-agent-{name}",
+ "security.acls.default.ingress.action": "reject",
+ "security.acls.default.egress.action": "reject",
+ "security.ipv4_filtering": "true",
+ }
+ },
+ }
+ )
+
+
+def acl_rules(name: str) -> list[dict[str, str]]:
+ gateway_rules = [
+ {"action": "allow", "description": "Runtime DNS", "destination": "10.248.18.1/32", "protocol": "udp", "destination_port": "53"},
+ {"action": "allow", "description": "Runtime DNS over TCP", "destination": "10.248.18.1/32", "protocol": "tcp", "destination_port": "53"},
+ {"action": "allow", "description": "Capability gateway", "destination": "10.248.18.1/32", "protocol": "tcp", "destination_port": "443"},
+ ]
+ if name == "offline":
+ return []
+ if name in {"brokered", "restricted", "release"}:
+ port = {"brokered": None, "restricted": "3128", "release": "3129"}[name]
+ rules = list(gateway_rules)
+ if port:
+ rules.append({"action": "allow", "description": f"{name.title()} HTTP CONNECT proxy", "destination": "10.248.18.1/32", "protocol": "tcp", "destination_port": port})
+ return rules
+ if name == "connected":
+ rules = list(gateway_rules)
+ for network in ("10.0.0.0/8", "100.64.0.0/10", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "224.0.0.0/4"):
+ rules.append({"action": "reject", "description": "Deny private or special-use IPv4", "destination": network})
+ rules.append({"action": "allow", "description": "Public IPv4 Internet"})
+ return rules
+ if name == "lab":
+ return [{"action": "allow", "description": "Experimental lab egress"}]
+ raise ManifestError(f"no ACL renderer for policy {name}")
+
+
+def policy_acl(name: str) -> str:
+ return yaml_text(
+ {
+ "description": f"VDM generated egress policy: {name}",
+ "config": {},
+ "ingress": [],
+ "egress": acl_rules(name),
+ }
+ )
+
+
+def rendered_files(data: Mapping[str, Any]) -> dict[Path, str]:
+ files: dict[Path, str] = {
+ ROOT / "VERSION": f"{data['platform']['version']}\n",
+ ROOT / "manifest/generated/platform.env": render_shell(data),
+ }
+ for name, image in data["images"].items():
+ files[ROOT / f"incus/profiles/generated/images/{name}.yaml"] = image_profile(name, image)
+ for name, size in data["dimensions"]["sizes"].items():
+ files[ROOT / f"incus/profiles/generated/sizes/{name}.yaml"] = size_profile(name, size)
+ for name, policy in data["dimensions"]["policies"].items():
+ files[ROOT / f"incus/profiles/generated/policies/{name}.yaml"] = policy_profile(name, policy)
+ files[ROOT / f"incus/acls/generated/{name}.yaml"] = policy_acl(name)
+ return files
+
+
+def matrix(data: Mapping[str, Any]) -> dict[str, list[dict[str, str]]]:
+ include: list[dict[str, str]] = []
+ architectures = [
+ name
+ for name, architecture in data["platform"]["architectures"].items()
+ if architecture["release"]
+ ]
+ for architecture in architectures:
+ for variant, image in data["images"].items():
+ if image["release"]:
+ include.append(
+ {
+ "variant": variant,
+ "architecture": architecture,
+ "size": image["default_size"],
+ "policy": image["default_policy"],
+ }
+ )
+ return {"include": include}
+
+
+def write_files(files: Mapping[Path, str]) -> None:
+ for path, content in files.items():
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.write_text(content, encoding="utf-8")
+
+
+def check_files(files: Mapping[Path, str]) -> bool:
+ ok = True
+ expected = set(files)
+ generated_roots = (
+ ROOT / "manifest/generated",
+ ROOT / "incus/profiles/generated",
+ ROOT / "incus/acls/generated",
+ )
+ for path, wanted in files.items():
+ current = path.read_text(encoding="utf-8") if path.exists() else ""
+ if current != wanted:
+ ok = False
+ relative = path.relative_to(ROOT)
+ sys.stderr.writelines(
+ difflib.unified_diff(
+ current.splitlines(keepends=True),
+ wanted.splitlines(keepends=True),
+ fromfile=f"{relative} (current)",
+ tofile=f"{relative} (generated)",
+ )
+ )
+ for root in generated_roots:
+ if not root.exists():
+ continue
+ for path in root.rglob("*"):
+ if path.is_file() and path not in expected:
+ print(f"unexpected generated file: {path.relative_to(ROOT)}", file=sys.stderr)
+ ok = False
+ return ok
+
+
+def parse_args() -> argparse.Namespace:
+ parser = argparse.ArgumentParser()
+ action = parser.add_mutually_exclusive_group(required=True)
+ action.add_argument("--write", action="store_true")
+ action.add_argument("--check", action="store_true")
+ action.add_argument("--matrix", choices=("github", "gitea"))
+ return parser.parse_args()
+
+
+def main() -> int:
+ args = parse_args()
+ try:
+ data = load_manifest()
+ validate_manifest(data)
+ if args.matrix:
+ print(json.dumps(matrix(data), separators=(",", ":"), sort_keys=True))
+ return 0
+ files = rendered_files(data)
+ if args.write:
+ write_files(files)
+ return 0
+ return 0 if check_files(files) else 1
+ except (ManifestError, OSError, yaml.YAMLError) as error:
+ print(f"platform manifest error: {error}", file=sys.stderr)
+ return 2
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/scripts/generate-provenance.sh b/scripts/generate-provenance.sh
new file mode 100755
index 0000000..3bf2349
--- /dev/null
+++ b/scripts/generate-provenance.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+PACKAGE_DIR="${1:?package directory required}"
+
+subjects="$(
+ jq '[.payload[] | {name:.name,digest:{sha256:.sha256}}]' "$PACKAGE_DIR/manifest.json"
+)"
+jq -n \
+ --argjson subject "$subjects" \
+ --arg revision "$(jq -r '.source_revision' "$PACKAGE_DIR/manifest.json")" \
+ --arg started "$(jq -r '.packaged_at' "$PACKAGE_DIR/manifest.json")" \
+ --arg builder "${VDM_BUILDER_ID:-https://platform.vdm.dev/builders/incus/unregistered}" \
+ '{
+ _type:"https://in-toto.io/Statement/v1",
+ subject:$subject,
+ predicateType:"https://slsa.dev/provenance/v1",
+ predicate:{
+ buildDefinition:{
+ buildType:"https://platform.vdm.dev/build-types/incus-image/v1",
+ externalParameters:{},
+ internalParameters:{},
+ resolvedDependencies:[{
+ uri:"git+https://github.com/vast-development-method/opencode-platform",
+ digest:{gitCommit:$revision}
+ }]
+ },
+ runDetails:{
+ builder:{id:$builder},
+ metadata:{invocationId:env.GITHUB_RUN_ID,startedOn:$started,finishedOn:(now | todateiso8601)}
+ }
+ }
+ }' > "$PACKAGE_DIR/provenance.intoto.json"
diff --git a/scripts/generate-sbom.sh b/scripts/generate-sbom.sh
new file mode 100755
index 0000000..9046088
--- /dev/null
+++ b/scripts/generate-sbom.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+PACKAGE_DIR="${1:?package directory required}"
+command -v syft >/dev/null 2>&1 || { printf 'syft is required\n' >&2; exit 1; }
+syft "dir:$PACKAGE_DIR/payload" --output "spdx-json=$PACKAGE_DIR/sbom.spdx.json"
+jq -e '.spdxVersion and (.packages | type == "array")' "$PACKAGE_DIR/sbom.spdx.json" >/dev/null
diff --git a/scripts/import-image-package.sh b/scripts/import-image-package.sh
index 6614294..216e990 100755
--- a/scripts/import-image-package.sh
+++ b/scripts/import-image-package.sh
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
set -Eeuo pipefail
-
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck disable=SC1091
source "$SCRIPT_DIR/lib/common.sh"
@@ -8,27 +7,18 @@ source "$SCRIPT_DIR/lib/common.sh"
PACKAGE_DIR="${1:-}"
REQUESTED_ALIAS="${2:-}"
[ -d "$PACKAGE_DIR" ] || die "Usage: $0 PACKAGE_DIRECTORY [IMAGE_ALIAS]"
-[ -f "$PACKAGE_DIR/manifest.json" ] || die "Package manifest is missing."
-[ -f "$PACKAGE_DIR/SHA256SUMS" ] || die "Package checksums are missing."
-
-(
- cd "$PACKAGE_DIR"
- sha256sum --check --strict SHA256SUMS
-)
+"$SCRIPT_DIR/verify-artifact.sh" "$PACKAGE_DIR"
-jq -e '
- .schema == 1 and
- (.platform | type == "string") and
- (.version | type == "string") and
- (.variant | type == "string") and
- (.payload | type == "array" and length > 0)
-' "$PACKAGE_DIR/manifest.json" >/dev/null || die "Package manifest is invalid."
+package_architecture="$(jq -r '.architecture' "$PACKAGE_DIR/manifest.json")"
+host_architecture="$(canonical_architecture "$(uname -m)")"
+[ "$package_architecture" = "$host_architecture" ] ||
+ die "Package architecture $package_architecture does not match host $host_architecture"
mapfile -t payload_names < <(jq -r '.payload[].name' "$PACKAGE_DIR/manifest.json")
metadata_files=()
data_files=()
for name in "${payload_names[@]}"; do
- [[ "$name" != */* && "$name" != .* ]] || die "Unsafe payload name: $name"
+ [[ "$name" == payload/* && "$name" != *..* ]] || die "Unsafe payload name: $name"
[ -f "$PACKAGE_DIR/$name" ] || die "Package payload is missing: $name"
if tar -tf "$PACKAGE_DIR/$name" 2>/dev/null | grep -Eq '^(\./)?metadata\.yaml$'; then
metadata_files+=("$PACKAGE_DIR/$name")
@@ -43,13 +33,10 @@ alias_name="${REQUESTED_ALIAS:-$(jq -r '.image' "$PACKAGE_DIR/manifest.json")}"
if [ -z "$alias_name" ] || [ "$alias_name" = null ]; then
die "No image alias was supplied or recorded."
fi
-if project_cmd image show "$alias_name" >/dev/null 2>&1; then
- die "Image alias already exists: $alias_name"
-fi
-
+project_cmd image show "$alias_name" >/dev/null 2>&1 && die "Image alias already exists: $alias_name"
project_cmd image import "${payload_files[@]}" --alias "$alias_name"
project_cmd image set-property "$alias_name" org.vdm.platform "$(jq -r '.platform' "$PACKAGE_DIR/manifest.json")"
project_cmd image set-property "$alias_name" org.vdm.version "$(jq -r '.version' "$PACKAGE_DIR/manifest.json")"
project_cmd image set-property "$alias_name" org.vdm.variant "$(jq -r '.variant' "$PACKAGE_DIR/manifest.json")"
-
+project_cmd image set-property "$alias_name" org.vdm.architecture "$package_architecture"
log "Imported $alias_name"
diff --git a/scripts/install-host-units.sh b/scripts/install-host-units.sh
new file mode 100755
index 0000000..05823e8
--- /dev/null
+++ b/scripts/install-host-units.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+# shellcheck disable=SC1091
+source "$SCRIPT_DIR/lib/common.sh"
+
+escaped_root="$(printf '%s' "$ROOT_DIR" | sed 's/[&|]/\\&/g')"
+tmp="$(mktemp)"
+trap 'rm -f "$tmp"' EXIT
+sed "s|@ROOT_DIR@|$escaped_root|g" \
+ "$ROOT_DIR/host/systemd/vdm-opencode-reaper.service.in" > "$tmp"
+sudo install -o root -g root -m 0644 "$tmp" /etc/systemd/system/vdm-opencode-reaper.service
+sudo install -o root -g root -m 0644 \
+ "$ROOT_DIR/host/systemd/vdm-opencode-reaper.timer" \
+ /etc/systemd/system/vdm-opencode-reaper.timer
+sudo systemctl daemon-reload
+sudo systemctl enable --now vdm-opencode-reaper.timer
+log "Installed the agent VM expiry reaper"
diff --git a/scripts/launch-vm.sh b/scripts/launch-vm.sh
index eb187ff..2300a34 100755
--- a/scripts/launch-vm.sh
+++ b/scripts/launch-vm.sh
@@ -6,14 +6,39 @@ source "$SCRIPT_DIR/lib/common.sh"
VARIANT="${1:-}"
NAME="${2:-}"
-variant_exists "$VARIANT" || die "Variant must be one of: base php python cpp typescript full"
-[ -n "$NAME" ] || die "Usage: $0 VARIANT INSTANCE_NAME"
+POLICY="${3:-${PLATFORM_IMAGE_DEFAULT_POLICY[$VARIANT]:-}}"
+SIZE="${4:-${PLATFORM_IMAGE_DEFAULT_SIZE[$VARIANT]:-}}"
+variant_exists "$VARIANT" || die "Variant must be one of: ${PLATFORM_IMAGES[*]}"
+[ -n "$NAME" ] || die "Usage: $0 VARIANT INSTANCE_NAME [POLICY] [SIZE]"
+policy_exists "$POLICY" || die "Unknown policy: $POLICY"
+size_exists "$SIZE" || die "Unknown size: $SIZE"
+case "${PLATFORM_POLICY_STATUS[$POLICY]}" in
+ ready) ;;
+ experimental)
+ [ "${VDM_ALLOW_EXPERIMENTAL_POLICY:-false}" = true ] ||
+ die "Policy $POLICY is experimental; set VDM_ALLOW_EXPERIMENTAL_POLICY=true to acknowledge it."
+ ;;
+ *) die "Policy $POLICY is blocked until its gateway and enforcement dependencies are configured." ;;
+esac
ALIAS="$(image_alias "$VARIANT")"
project_cmd image show "$ALIAS" >/dev/null 2>&1 || die "Image not found: $ALIAS. Build or import it first."
project_cmd info "$NAME" >/dev/null 2>&1 && die "Instance already exists: $NAME"
-project_cmd init "$ALIAS" "$NAME" --vm --profile "vdm-opencode-${VARIANT}"
+project_cmd init "$ALIAS" "$NAME" --vm \
+ --profile "vdm-opencode-${VARIANT}" \
+ --profile "vdm-size-$SIZE" \
+ --profile "vdm-policy-$POLICY"
+project_cmd config set "$NAME" user.vdm.owner "${VDM_SESSION_OWNER:-$USER}"
+project_cmd config set "$NAME" user.vdm.team "${VDM_SESSION_TEAM:-individual}"
+project_cmd config set "$NAME" user.vdm.policy "$POLICY"
+project_cmd config set "$NAME" user.vdm.size "$SIZE"
+project_cmd config set "$NAME" user.vdm.repository.trust "${VDM_REPOSITORY_TRUST:-trusted}"
+project_cmd config set "$NAME" user.vdm.repository.allowlist "${VDM_REPOSITORY_ALLOWLIST:-none}"
+project_cmd config set "$NAME" user.vdm.providers.allowlist "${VDM_PROVIDER_ALLOWLIST:-local-default}"
+project_cmd config set "$NAME" user.vdm.session.budget_usd "${VDM_SESSION_BUDGET_USD:-0}"
+project_cmd config set "$NAME" user.vdm.session.ttl "${VDM_SESSION_TTL:-$DEFAULT_SESSION_TTL}"
+project_cmd config set "$NAME" user.vdm.workspace.lifecycle "${VDM_WORKSPACE_LIFECYCLE:-disposable}"
project_cmd start "$NAME"
wait_for_vm "$NAME" || die "VM agent did not become ready: $NAME"
project_cmd snapshot create "$NAME" factory
diff --git a/scripts/launch-wizard.sh b/scripts/launch-wizard.sh
new file mode 100755
index 0000000..96e8fef
--- /dev/null
+++ b/scripts/launch-wizard.sh
@@ -0,0 +1,60 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+# shellcheck disable=SC1091
+source "$SCRIPT_DIR/lib/common.sh"
+
+prompt() {
+ local label="$1"
+ local default="${2:-}"
+ local value
+ if [ -n "$default" ]; then
+ read -r -p "$label [$default]: " value
+ printf '%s\n' "${value:-$default}"
+ else
+ read -r -p "$label: " value
+ [ -n "$value" ] || die "$label is required"
+ printf '%s\n' "$value"
+ fi
+}
+
+IMAGE="$(prompt "Image (${PLATFORM_IMAGES[*]})" base)"
+variant_exists "$IMAGE" || die "Unknown image: $IMAGE"
+INSTANCE="$(prompt "Instance name")"
+[[ "$INSTANCE" =~ ^[a-zA-Z0-9][a-zA-Z0-9.-]*$ ]] || die "Unsafe instance name"
+OWNER="$(prompt "Owner" "${USER:-unknown}")"
+TEAM="$(prompt "Team" individual)"
+TRUST="$(prompt "Repository trust (trusted/untrusted)" trusted)"
+case "$TRUST" in trusted|untrusted) ;; *) die "Trust must be trusted or untrusted" ;; esac
+
+default_policy="${PLATFORM_IMAGE_DEFAULT_POLICY[$IMAGE]}"
+[ "$TRUST" = untrusted ] && default_policy=offline
+POLICY="$(prompt "Network policy" "$default_policy")"
+policy_exists "$POLICY" || die "Unknown policy: $POLICY"
+SIZE="$(prompt "Resource size" "${PLATFORM_IMAGE_DEFAULT_SIZE[$IMAGE]}")"
+size_exists "$SIZE" || die "Unknown size: $SIZE"
+TTL="$(prompt "Maximum session TTL" "$DEFAULT_SESSION_TTL")"
+TTL_SECONDS="$(duration_to_seconds "$TTL")"
+((TTL_SECONDS >= 60 && TTL_SECONDS <= 86400)) || die "TTL must be between one minute and 24 hours"
+WORKSPACE="$(prompt "Workspace lifecycle (disposable/retained)" disposable)"
+case "$WORKSPACE" in disposable|retained) ;; *) die "Workspace lifecycle must be disposable or retained" ;; esac
+REPOSITORIES="$(prompt "Allowed repositories (comma-separated, metadata only)" none)"
+PROVIDERS="$(prompt "Allowed model routes (comma-separated)" local-default)"
+BUDGET="$(prompt "Session budget in USD (0 means externally enforced)" 0)"
+[[ "$BUDGET" =~ ^[0-9]+([.][0-9]{1,2})?$ ]] || die "Budget must be a non-negative number"
+
+export VDM_SESSION_OWNER="$OWNER"
+export VDM_SESSION_TEAM="$TEAM"
+export VDM_REPOSITORY_TRUST="$TRUST"
+export VDM_WORKSPACE_LIFECYCLE="$WORKSPACE"
+export VDM_REPOSITORY_ALLOWLIST="$REPOSITORIES"
+export VDM_PROVIDER_ALLOWLIST="$PROVIDERS"
+export VDM_SESSION_BUDGET_USD="$BUDGET"
+export VDM_SESSION_TTL="$TTL"
+
+"$SCRIPT_DIR/launch-vm.sh" "$IMAGE" "$INSTANCE" "$POLICY" "$SIZE"
+
+printf '\nCreated %s with policy=%s, size=%s, trust=%s, TTL=%s.\n' \
+ "$INSTANCE" "$POLICY" "$SIZE" "$TRUST" "$TTL"
+printf 'Create its runtime credentials with: %s/create-runtime-env.sh %s\n' "$SCRIPT_DIR" "$INSTANCE"
+printf 'Start it with: %s/start-session.sh %s %s\n' "$SCRIPT_DIR" "$INSTANCE" "$TTL"
diff --git a/scripts/lib/common.sh b/scripts/lib/common.sh
index f59fbcd..8fc0ecd 100755
--- a/scripts/lib/common.sh
+++ b/scripts/lib/common.sh
@@ -3,6 +3,8 @@ set -Eeuo pipefail
ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
# shellcheck disable=SC1091
+source "$ROOT_DIR/manifest/generated/platform.env"
+# shellcheck disable=SC1091
source "$ROOT_DIR/manifest/platform.env"
# shellcheck disable=SC1091
source "$ROOT_DIR/manifest/toolchain.env"
@@ -31,6 +33,23 @@ require_command() {
command -v "$1" >/dev/null 2>&1 || die "Required command not found: $1"
}
+duration_to_seconds() {
+ local value="${1:?duration required}"
+ local amount
+ local suffix
+
+ [[ "$value" =~ ^([1-9][0-9]*)(s|m|h|d)?$ ]] ||
+ die "Invalid duration: $value (use seconds or a suffix: s, m, h, d)"
+ amount="${BASH_REMATCH[1]}"
+ suffix="${BASH_REMATCH[2]:-s}"
+ case "$suffix" in
+ s) printf '%s\n' "$amount" ;;
+ m) printf '%s\n' "$((amount * 60))" ;;
+ h) printf '%s\n' "$((amount * 3600))" ;;
+ d) printf '%s\n' "$((amount * 86400))" ;;
+ esac
+}
+
incus_cmd() {
if incus info >/dev/null 2>&1; then
incus "$@"
@@ -56,12 +75,42 @@ wait_for_vm() {
}
variant_exists() {
- case "$1" in
- base|php|python|cpp|typescript|full) return 0 ;;
- *) return 1 ;;
- esac
+ [[ -n "${1:-}" && -v "PLATFORM_IMAGE_COMPONENTS[$1]" ]]
+}
+
+policy_exists() {
+ [[ -n "${1:-}" && -v "PLATFORM_POLICY_STATUS[$1]" ]]
+}
+
+size_exists() {
+ [[ -n "${1:-}" && -v "PLATFORM_SIZE_CPUS[$1]" ]]
+}
+
+image_has_component() {
+ local image="${1:?image required}"
+ local wanted="${2:?component required}"
+ local component
+
+ for component in ${PLATFORM_IMAGE_COMPONENTS[$image]}; do
+ [[ "$component" == "$wanted" ]] && return 0
+ done
+ return 1
+}
+
+canonical_architecture() {
+ local raw="${1:-$(uname -m)}"
+ [[ -v "PLATFORM_ARCH_ALIASES[$raw]" ]] || die "Unsupported architecture: $raw"
+ printf '%s\n' "${PLATFORM_ARCH_ALIASES[$raw]}"
}
image_alias() {
- printf '%s-%s/%s' "$INCUS_IMAGE_PREFIX" "$1" "$PLATFORM_VERSION"
+ local variant="${1:?variant required}"
+ local architecture="${2:-$(canonical_architecture "$(uname -m)")}"
+ printf '%s-%s/%s-%s' "$INCUS_IMAGE_PREFIX" "$variant" "$PLATFORM_VERSION" "$architecture"
+}
+
+artifact_id() {
+ local variant="${1:?variant required}"
+ local architecture="${2:-$(canonical_architecture "$(uname -m)")}"
+ printf '%s-%s-%s-%s' "$INCUS_IMAGE_PREFIX" "$variant" "$PLATFORM_VERSION" "$architecture"
}
diff --git a/scripts/lib/variant-selection.sh b/scripts/lib/variant-selection.sh
old mode 100644
new mode 100755
index d440171..9560f89
--- a/scripts/lib/variant-selection.sh
+++ b/scripts/lib/variant-selection.sh
@@ -1,7 +1,11 @@
#!/usr/bin/env bash
set -Eeuo pipefail
-LOCAL_RELEASE_ALL_VARIANTS=(base php python cpp typescript full)
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+# shellcheck disable=SC1091
+source "$SCRIPT_DIR/common.sh"
+
+LOCAL_RELEASE_ALL_VARIANTS=("${PLATFORM_RELEASE_IMAGES[@]}")
parse_variant_selection() {
local raw_selection="${1-}"
@@ -36,13 +40,10 @@ parse_variant_selection() {
return 0
fi
- case "$variant" in
- base|php|python|cpp|typescript|full) ;;
- *)
- printf 'Unknown variant: %s\n' "$variant" >&2
- return 2
- ;;
- esac
+ if ! variant_exists "$variant"; then
+ printf 'Unknown variant: %s\n' "$variant" >&2
+ return 2
+ fi
if [[ -z "${seen[$variant]:-}" ]]; then
output+=("$variant")
diff --git a/scripts/list-vms.sh b/scripts/list-vms.sh
new file mode 100755
index 0000000..6f60e52
--- /dev/null
+++ b/scripts/list-vms.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+# shellcheck disable=SC1091
+source "$SCRIPT_DIR/lib/common.sh"
+
+project_cmd list --format json | jq -r '
+ ["NAME","STATE","OWNER","TEAM","IMAGE","POLICY","SIZE","TRUST","EXPIRES"],
+ (.[] | [
+ .name,
+ .status,
+ (.config["user.vdm.owner"] // "-"),
+ (.config["user.vdm.team"] // "-"),
+ (.config["user.vdm.variant"] // "-"),
+ (.config["user.vdm.policy"] // "-"),
+ (.config["user.vdm.size"] // "-"),
+ (.config["user.vdm.repository.trust"] // "-"),
+ (.config["user.vdm.session.expires_epoch"] // "-")
+ ]) | @tsv' | column -t -s $'\t'
diff --git a/scripts/local-image-release.sh b/scripts/local-image-release.sh
index f75d0eb..6990037 100755
--- a/scripts/local-image-release.sh
+++ b/scripts/local-image-release.sh
@@ -58,6 +58,7 @@ fi
"$ROOT_DIR/tests/validate-repository.sh"
"$SCRIPT_DIR/ci/check-incus-runner.sh"
+architecture="$(canonical_architecture "$(uname -m)")"
install -d -m 0750 "$ROOT_DIR/build"
exec 9>"$ROOT_DIR/build/.local-release.lock"
@@ -70,7 +71,7 @@ for variant in "${variants[@]}"; do
log "Building $variant"
"$SCRIPT_DIR/build-image.sh" "$variant"
- package_dir="$ROOT_DIR/build/packages/$PLATFORM_VERSION/$variant"
+ package_dir="$ROOT_DIR/build/packages/$PLATFORM_VERSION/$architecture/$variant"
"$SCRIPT_DIR/package-image.sh" "$variant" "$package_dir"
(
cd "$package_dir"
diff --git a/scripts/occtl.sh b/scripts/occtl.sh
index c17c665..356ebbf 100755
--- a/scripts/occtl.sh
+++ b/scripts/occtl.sh
@@ -11,6 +11,8 @@ case "$command" in
build) exec "$SCRIPT_DIR/build-image.sh" "$@" ;;
build-all) exec "$SCRIPT_DIR/build-all-images.sh" "$@" ;;
launch) exec "$SCRIPT_DIR/launch-vm.sh" "$@" ;;
+ launch-wizard) exec "$SCRIPT_DIR/launch-wizard.sh" "$@" ;;
+ list) exec "$SCRIPT_DIR/list-vms.sh" "$@" ;;
session) exec "$SCRIPT_DIR/start-session.sh" "$@" ;;
stop-session) exec "$SCRIPT_DIR/stop-session.sh" "$@" ;;
runtime-env) exec "$SCRIPT_DIR/create-runtime-env.sh" "$@" ;;
@@ -30,6 +32,8 @@ occtl commands:
build VARIANT
build-all
launch VARIANT INSTANCE
+ launch-wizard
+ list
runtime-env INSTANCE
session INSTANCE [RUNTIME_ENV_FILE]
stop-session INSTANCE
diff --git a/scripts/package-image.sh b/scripts/package-image.sh
index dcada41..fcf4d4b 100755
--- a/scripts/package-image.sh
+++ b/scripts/package-image.sh
@@ -5,60 +5,112 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/common.sh"
VARIANT="${1:-}"
-OUTPUT_DIR="${2:-$ROOT_DIR/build/packages/${PLATFORM_VERSION}/${VARIANT}}"
+ARCHITECTURE="$(canonical_architecture "${VDM_BUILD_ARCHITECTURE:-}")"
+OUTPUT_DIR="${2:-$ROOT_DIR/build/packages/${PLATFORM_VERSION}/${ARCHITECTURE}/${VARIANT}}"
variant_exists "$VARIANT" || die "Unknown variant: $VARIANT"
-ALIAS="$(image_alias "$VARIANT")"
+ALIAS="$(image_alias "$VARIANT" "$ARCHITECTURE")"
+ARTIFACT_ID="$(artifact_id "$VARIANT" "$ARCHITECTURE")"
install -d -m 0750 "$OUTPUT_DIR"
find "$OUTPUT_DIR" -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +
-project_cmd image export "$ALIAS" "$OUTPUT_DIR/${INCUS_IMAGE_PREFIX}-${VARIANT}-${PLATFORM_VERSION}"
+install -d -m 0750 "$OUTPUT_DIR/payload" "$OUTPUT_DIR/evidence"
+project_cmd image export "$ALIAS" "$OUTPUT_DIR/payload/$ARTIFACT_ID"
source_revision="unknown"
+source_tag=""
if command -v git >/dev/null 2>&1 && git -C "$ROOT_DIR" rev-parse --verify HEAD >/dev/null 2>&1; then
source_revision="$(git -C "$ROOT_DIR" rev-parse HEAD)"
+ source_tag="$(git -C "$ROOT_DIR" describe --tags --exact-match HEAD 2>/dev/null || true)"
fi
payload_json="$(
- find "$OUTPUT_DIR" -maxdepth 1 -type f -printf '%f\n' | LC_ALL=C sort | while IFS= read -r name; do
+ find "$OUTPUT_DIR/payload" -maxdepth 1 -type f -printf '%f\n' | LC_ALL=C sort | while IFS= read -r name; do
jq -n \
- --arg name "$name" \
- --arg sha256 "$(sha256sum "$OUTPUT_DIR/$name" | awk '{print $1}')" \
- --argjson bytes "$(stat -c '%s' "$OUTPUT_DIR/$name")" \
+ --arg name "payload/$name" \
+ --arg sha256 "$(sha256sum "$OUTPUT_DIR/payload/$name" | awk '{print $1}')" \
+ --argjson bytes "$(stat -c '%s' "$OUTPUT_DIR/payload/$name")" \
'{name:$name,sha256:$sha256,bytes:$bytes}'
done | jq -s .
)"
jq -n \
- --argjson schema 1 \
- --arg platform "$PLATFORM_NAME" \
- --arg version "$PLATFORM_VERSION" \
- --arg variant "$VARIANT" \
- --arg image "$ALIAS" \
- --arg architecture "$(uname -m)" \
- --arg source_revision "$source_revision" \
- --arg built_at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
- --argjson payload "$payload_json" \
- '{
- schema:$schema,
- platform:$platform,
- version:$version,
- variant:$variant,
- image:$image,
- architecture:$architecture,
- source_revision:$source_revision,
- packaged_at:$built_at,
- payload:$payload
- }' \
- > "$OUTPUT_DIR/manifest.json"
+ --argjson schema 2 \
+ --arg artifact_id "$ARTIFACT_ID" \
+ --arg platform "$PLATFORM_NAME" \
+ --arg version "$PLATFORM_VERSION" \
+ --arg variant "$VARIANT" \
+ --arg image "$ALIAS" \
+ --arg architecture "$ARCHITECTURE" \
+ --arg incus_architecture "$(uname -m)" \
+ --arg source_revision "$source_revision" \
+ --arg source_tag "$source_tag" \
+ --arg packaged_at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
+ --argjson payload "$payload_json" \
+ '{
+ schema:$schema,
+ artifact_id:$artifact_id,
+ platform:$platform,
+ version:$version,
+ variant:$variant,
+ image:$image,
+ architecture:$architecture,
+ incus_architecture:$incus_architecture,
+ source_revision:$source_revision,
+ source_tag:$source_tag,
+ packaged_at:$packaged_at,
+ payload:$payload,
+ supply_chain:{sbom:"not-generated",vulnerability_scan:"not-generated",signature:"not-generated"}
+ }' > "$OUTPUT_DIR/manifest.json"
+
+if command -v syft >/dev/null 2>&1; then
+ "$SCRIPT_DIR/generate-sbom.sh" "$OUTPUT_DIR"
+ tmp="$(mktemp)"
+ jq '.supply_chain.sbom = "sbom.spdx.json"' "$OUTPUT_DIR/manifest.json" > "$tmp"
+ install -m 0640 "$tmp" "$OUTPUT_DIR/manifest.json"
+ rm -f "$tmp"
+elif [ "${VDM_RELEASE_MODE:-false}" = true ]; then
+ die "syft is required in release mode"
+fi
+
+if [ -f "$OUTPUT_DIR/sbom.spdx.json" ] && command -v grype >/dev/null 2>&1; then
+ "$SCRIPT_DIR/scan-sbom.sh" "$OUTPUT_DIR"
+ tmp="$(mktemp)"
+ jq '.supply_chain.vulnerability_scan = "vulnerabilities.grype.json"' "$OUTPUT_DIR/manifest.json" > "$tmp"
+ install -m 0640 "$tmp" "$OUTPUT_DIR/manifest.json"
+ rm -f "$tmp"
+elif [ "${VDM_RELEASE_MODE:-false}" = true ]; then
+ die "grype and a generated SBOM are required in release mode"
+fi
+
+"$SCRIPT_DIR/generate-provenance.sh" "$OUTPUT_DIR"
+
+if [ -n "${COSIGN_KEY:-}" ]; then
+ tmp="$(mktemp)"
+ jq '.supply_chain.signature = "SHA256SUMS.sigstore.json"' "$OUTPUT_DIR/manifest.json" > "$tmp"
+ install -m 0640 "$tmp" "$OUTPUT_DIR/manifest.json"
+ rm -f "$tmp"
+fi
checksums_file="$(mktemp)"
trap 'rm -f "$checksums_file"' EXIT
(
cd "$OUTPUT_DIR"
- find . -maxdepth 1 -type f ! -name SHA256SUMS -printf '%P\0' \
- | LC_ALL=C sort -z \
- | xargs -0 sha256sum > "$checksums_file"
+ find . -type f \
+ ! -name SHA256SUMS \
+ ! -name SHA256SUMS.sigstore.json \
+ -printf '%P\0' |
+ LC_ALL=C sort -z |
+ xargs -0 sha256sum > "$checksums_file"
)
install -m 0640 "$checksums_file" "$OUTPUT_DIR/SHA256SUMS"
+rm -f "$checksums_file"
+trap - EXIT
+
+if [ -n "${COSIGN_KEY:-}" ]; then
+ "$SCRIPT_DIR/sign-artifact.sh" "$OUTPUT_DIR"
+elif [ "${VDM_RELEASE_MODE:-false}" = true ]; then
+ die "COSIGN_KEY (normally openbao://vdm-opencode-release) is required in release mode"
+fi
-log "Packaged image in $OUTPUT_DIR"
+"$SCRIPT_DIR/verify-artifact.sh" "$OUTPUT_DIR"
+log "Packaged $ARTIFACT_ID in $OUTPUT_DIR"
diff --git a/scripts/publish-gitea-package.sh b/scripts/publish-gitea-package.sh
index 0294fe6..67f36f1 100755
--- a/scripts/publish-gitea-package.sh
+++ b/scripts/publish-gitea-package.sh
@@ -5,25 +5,96 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/common.sh"
VARIANT="${1:-}"
-PACKAGE_DIR="${2:-$ROOT_DIR/build/packages/${PLATFORM_VERSION}/${VARIANT}}"
+ARCHITECTURE="$(canonical_architecture "${VDM_BUILD_ARCHITECTURE:-}")"
+PACKAGE_DIR="${2:-$ROOT_DIR/build/packages/${PLATFORM_VERSION}/${ARCHITECTURE}/${VARIANT}}"
variant_exists "$VARIANT" || die "Unknown variant: $VARIANT"
[ -d "$PACKAGE_DIR" ] || die "Package directory missing: $PACKAGE_DIR"
+"$SCRIPT_DIR/verify-artifact.sh" "$PACKAGE_DIR"
: "${GITEA_PACKAGE_OWNER:?Set GITEA_PACKAGE_OWNER}"
: "${GITEA_PACKAGE_TOKEN:?Set GITEA_PACKAGE_TOKEN in the CI runtime only}"
GITEA_PACKAGE_USER="${GITEA_PACKAGE_USER:-package-publisher}"
-PACKAGE_NAME="${GITEA_PACKAGE_NAME:-vdm-opencode-${VARIANT}}"
+[[ "$GITEA_PACKAGE_USER" =~ ^[A-Za-z0-9_.@+-]+$ ]] || die "Unsafe Gitea package user"
+[[ "$GITEA_PACKAGE_TOKEN" != *$'\n'* && "$GITEA_PACKAGE_TOKEN" != *'"'* ]] || die "Unsafe Gitea token encoding"
-for file in "$PACKAGE_DIR"/*; do
- [ -f "$file" ] || continue
+PACKAGE_NAME="${GITEA_PACKAGE_NAME:-vdm-opencode-${VARIANT}-${ARCHITECTURE}}"
+ARTIFACT_ID="$(artifact_id "$VARIANT" "$ARCHITECTURE")"
+STAGING="$(mktemp -d)"
+trap 'rm -rf "$STAGING"' EXIT
+BUNDLE="$STAGING/${ARTIFACT_ID}.tar.zst"
+
+tar --sort=name --mtime='UTC 1970-01-01' --owner=0 --group=0 --numeric-owner \
+ -C "$PACKAGE_DIR" -cf - . | zstd --quiet --threads=0 -19 -o "$BUNDLE"
+BUNDLE_SHA="$(sha256sum "$BUNDLE" | awk '{print $1}')"
+BUNDLE_SIZE="$(stat -c '%s' "$BUNDLE")"
+
+jq -n \
+ --arg schema "1" \
+ --arg artifact_id "$ARTIFACT_ID" \
+ --arg version "$PLATFORM_VERSION" \
+ --arg variant "$VARIANT" \
+ --arg architecture "$ARCHITECTURE" \
+ --arg bundle "$(basename "$BUNDLE")" \
+ --arg sha256 "$BUNDLE_SHA" \
+ --argjson bytes "$BUNDLE_SIZE" \
+ --arg published_at "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
+ '{schema:($schema|tonumber),artifact_id:$artifact_id,version:$version,variant:$variant,
+ architecture:$architecture,bundle:$bundle,sha256:$sha256,bytes:$bytes,published_at:$published_at}' \
+ > "$STAGING/release-entry.json"
+
+if [ -n "${COSIGN_KEY:-}" ]; then
+ cosign sign-blob --yes --tlog-upload=false --key "$COSIGN_KEY" \
+ --bundle "$STAGING/release-entry.sigstore.json" "$STAGING/release-entry.json"
+elif [ "${VDM_RELEASE_MODE:-false}" = true ]; then
+ die "COSIGN_KEY is required for tagged release publication"
+fi
+
+MARKER="$STAGING/${ARTIFACT_ID}.complete.tar"
+marker_files=(release-entry.json)
+if [ -f "$STAGING/release-entry.sigstore.json" ]; then
+ marker_files+=(release-entry.sigstore.json)
+fi
+tar --sort=name --mtime='UTC 1970-01-01' --owner=0 --group=0 --numeric-owner \
+ -C "$STAGING" -cf "$MARKER" "${marker_files[@]}"
+
+gitea_curl() {
+ local method="${1:?method required}"
+ local url="${2:?url required}"
+ shift 2
+ printf 'user = "%s:%s"\n' "$GITEA_PACKAGE_USER" "$GITEA_PACKAGE_TOKEN" |
+ curl --config - --request "$method" --silent --show-error \
+ --retry 4 --retry-all-errors --connect-timeout 15 "$@" "$url"
+}
+
+publish_immutable() {
+ local file="${1:?file required}"
+ local name
+ local url
+ local status
+ local remote
+ local local_sha
+ local remote_sha
name="$(basename "$file")"
- curl --fail-with-body --silent --show-error \
- --retry 4 \
- --retry-all-errors \
- --connect-timeout 15 \
- --user "${GITEA_PACKAGE_USER}:${GITEA_PACKAGE_TOKEN}" \
- --upload-file "$file" \
- "${GITEA_BASE_URL}/api/packages/${GITEA_PACKAGE_OWNER}/generic/${PACKAGE_NAME}/${PLATFORM_VERSION}/${name}"
-done
-
-log "Published ${PACKAGE_NAME}/${PLATFORM_VERSION}"
+ url="${GITEA_BASE_URL}/api/packages/${GITEA_PACKAGE_OWNER}/generic/${PACKAGE_NAME}/${PLATFORM_VERSION}/${name}"
+ status="$(gitea_curl HEAD "$url" --output /dev/null --write-out '%{http_code}')"
+ case "$status" in
+ 404)
+ gitea_curl PUT "$url" --upload-file "$file" --fail-with-body >/dev/null
+ ;;
+ 200) ;;
+ *) die "Unexpected Gitea response for $name: HTTP $status" ;;
+ esac
+ remote="$(mktemp)"
+ gitea_curl GET "$url" --fail-with-body --output "$remote"
+ local_sha="$(sha256sum "$file" | awk '{print $1}')"
+ remote_sha="$(sha256sum "$remote" | awk '{print $1}')"
+ rm -f "$remote"
+ [ "$local_sha" = "$remote_sha" ] ||
+ die "Published object differs from local object: $name"
+}
+
+# The completion marker is deliberately uploaded last. Consumers must ignore
+# an artifact unless this immutable marker exists and verifies.
+publish_immutable "$BUNDLE"
+publish_immutable "$MARKER"
+log "Published atomic package marker for ${PACKAGE_NAME}/${PLATFORM_VERSION}"
diff --git a/scripts/reap-expired-vms.sh b/scripts/reap-expired-vms.sh
new file mode 100755
index 0000000..a204b5d
--- /dev/null
+++ b/scripts/reap-expired-vms.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
+# shellcheck disable=SC1091
+source "$SCRIPT_DIR/lib/common.sh"
+
+NOW="${VDM_REAPER_NOW:-$(date +%s)}"
+[[ "$NOW" =~ ^[0-9]+$ ]] || die "VDM_REAPER_NOW must be an epoch integer"
+
+mapfile -t rows < <(
+ project_cmd list --format json |
+ jq -r '.[] | select(.status == "Running") |
+ [.name, (.config["user.vdm.session.expires_epoch"] // "")] | @tsv'
+)
+
+for row in "${rows[@]}"; do
+ IFS=$'\t' read -r name expires <<< "$row"
+ [ -n "$expires" ] || continue
+ if [[ ! "$expires" =~ ^[0-9]+$ ]]; then
+ warn "Ignoring malformed expiry metadata on $name: $expires"
+ continue
+ fi
+ if ((expires <= NOW)); then
+ log "Stopping expired agent VM $name"
+ # The single-quoted command is intentionally evaluated inside the guest.
+ # shellcheck disable=SC2016
+ project_cmd exec "$name" -- bash -c \
+ 'systemctl list-units --type=service --all --no-legend "vdm-opencode-*.service" |
+ awk "{print \$1}" | xargs -r systemctl stop' >/dev/null 2>&1 || true
+ project_cmd stop "$name" --timeout 30 >/dev/null 2>&1 || project_cmd stop "$name" --force
+ project_cmd config unset "$name" user.vdm.session.id >/dev/null 2>&1 || true
+ project_cmd config unset "$name" user.vdm.session.expires_epoch >/dev/null 2>&1 || true
+ fi
+done
diff --git a/scripts/scan-sbom.sh b/scripts/scan-sbom.sh
new file mode 100755
index 0000000..918638b
--- /dev/null
+++ b/scripts/scan-sbom.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+PACKAGE_DIR="${1:?package directory required}"
+command -v grype >/dev/null 2>&1 || { printf 'grype is required\n' >&2; exit 1; }
+grype "sbom:$PACKAGE_DIR/sbom.spdx.json" --output json > "$PACKAGE_DIR/vulnerabilities.grype.json"
+jq -e '.matches | type == "array"' "$PACKAGE_DIR/vulnerabilities.grype.json" >/dev/null
+
+critical="$(jq '[.matches[] | select(.vulnerability.severity == "Critical")] | length' "$PACKAGE_DIR/vulnerabilities.grype.json")"
+high_fixed="$(jq '[.matches[] | select(.vulnerability.severity == "High" and ((.vulnerability.fix.versions // []) | length > 0))] | length' "$PACKAGE_DIR/vulnerabilities.grype.json")"
+jq -n \
+ --argjson critical "$critical" \
+ --argjson high_with_fix "$high_fixed" \
+ --arg result "$([ "$critical" -eq 0 ] && [ "$high_fixed" -eq 0 ] && printf pass || printf fail)" \
+ '{policy:"security/vulnerability-policy.yaml",critical:$critical,high_with_fix:$high_with_fix,result:$result}' \
+ > "$PACKAGE_DIR/evidence/vulnerability-policy-result.json"
+if [ "$critical" -ne 0 ] || [ "$high_fixed" -ne 0 ]; then
+ printf 'Vulnerability policy failed: critical=%s high-with-fix=%s\n' "$critical" "$high_fixed" >&2
+ exit 1
+fi
diff --git a/scripts/sign-artifact.sh b/scripts/sign-artifact.sh
new file mode 100755
index 0000000..8f9a7c3
--- /dev/null
+++ b/scripts/sign-artifact.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+PACKAGE_DIR="${1:?package directory required}"
+: "${COSIGN_KEY:?Set COSIGN_KEY, preferably to openbao://vdm-opencode-release}"
+command -v cosign >/dev/null 2>&1 || { printf 'cosign is required\n' >&2; exit 1; }
+cosign sign-blob \
+ --yes \
+ --tlog-upload=false \
+ --key "$COSIGN_KEY" \
+ --bundle "$PACKAGE_DIR/SHA256SUMS.sigstore.json" \
+ "$PACKAGE_DIR/SHA256SUMS"
diff --git a/scripts/start-session.sh b/scripts/start-session.sh
index 7fb8645..d388114 100755
--- a/scripts/start-session.sh
+++ b/scripts/start-session.sh
@@ -5,48 +5,115 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/lib/common.sh"
NAME="${1:-}"
-[ -n "$NAME" ] || die "Usage: $0 INSTANCE_NAME [HOST_RUNTIME_ENV_FILE]"
+[ -n "$NAME" ] || die "Usage: $0 INSTANCE_NAME [HOST_RUNTIME_ENV_FILE] [TTL]"
HOST_ENV_FILE="${2:-/run/user/${UID}/vdm-opencode/${NAME}.env}"
+TTL="${3:-$DEFAULT_SESSION_TTL}"
+TTL_SECONDS="$(duration_to_seconds "$TTL")"
+((TTL_SECONDS >= 60 && TTL_SECONDS <= 86400)) ||
+ die "Session TTL must be between 60 seconds and 24 hours."
project_cmd info "$NAME" >/dev/null 2>&1 || die "Unknown instance: $NAME"
project_cmd start "$NAME" >/dev/null 2>&1 || true
wait_for_vm "$NAME" || die "VM agent did not become ready: $NAME"
-declare -a EXEC_ENV
-if [ -f "$HOST_ENV_FILE" ]; then
- [ "$(stat -c '%a' "$HOST_ENV_FILE")" = 600 ] || die "Runtime env file must have mode 0600: $HOST_ENV_FILE"
+allowed_key() {
+ case "$1" in
+ VDM_LLM_GATEWAY_URL|VDM_LLM_GATEWAY_TOKEN|\
+ GITHUB_MCP_URL|GITHUB_MCP_TOKEN|\
+ GITEA_MCP_URL|GITEA_MCP_TOKEN|\
+ NEXTCLOUD_MCP_URL|NEXTCLOUD_MCP_TOKEN|\
+ JOOMLA_MCP_URL|JOOMLA_MCP_TOKEN|\
+ JCB_MCP_URL|JCB_MCP_TOKEN|\
+ STT_MCP_URL|STT_MCP_TOKEN|\
+ VDM_LOCAL_LLM_BASE_URL|VDM_LOCAL_LLM_MODEL) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+validate_runtime_file() {
+ local file="$1"
+ local line
+ local key
+ if [ ! -f "$file" ] || [ -L "$file" ]; then
+ die "Runtime env must be a regular non-symlink file: $file"
+ fi
+ [ "$(stat -c '%u' "$file")" = "$UID" ] || die "Runtime env file must be owned by UID $UID: $file"
+ [ "$(stat -c '%a' "$file")" = 600 ] || die "Runtime env file must have mode 0600: $file"
+ [ "$(stat -c '%h' "$file")" = 1 ] || die "Runtime env file must have exactly one hard link: $file"
while IFS= read -r line || [ -n "$line" ]; do
case "$line" in
""|\#*) continue ;;
- *=*) EXEC_ENV+=(--env "$line") ;;
- *) die "Invalid runtime environment line in $HOST_ENV_FILE" ;;
+ *=*)
+ key="${line%%=*}"
+ [[ "$key" =~ ^[A-Z][A-Z0-9_]*$ ]] || die "Invalid runtime variable name: $key"
+ allowed_key "$key" || die "Runtime variable is not allowed: $key"
+ ;;
+ *) die "Invalid runtime environment line in $file" ;;
esac
- done < "$HOST_ENV_FILE"
+ done < "$file"
+}
+
+empty_env="$(mktemp)"
+trap 'rm -f "$empty_env"' EXIT
+chmod 0600 "$empty_env"
+if [ -f "$HOST_ENV_FILE" ]; then
+ validate_runtime_file "$HOST_ENV_FILE"
+else
+ HOST_ENV_FILE="$empty_env"
fi
SESSION_ID="$(date +%s)-$$"
-GUEST_RUNTIME="/run/vdm-opencode-session/${SESSION_ID}"
+UNIT="vdm-opencode-${SESSION_ID}"
+GUEST_INPUT_DIR="/run/vdm-opencode-input"
+GUEST_CREDENTIAL="${GUEST_INPUT_DIR}/${SESSION_ID}.env"
+EXPIRES_EPOCH="$(($(date +%s) + TTL_SECONDS))"
cleanup() {
- project_cmd exec "$NAME" -- rm -rf "$GUEST_RUNTIME" >/dev/null 2>&1 || true
+ project_cmd exec "$NAME" -- rm -f "$GUEST_CREDENTIAL" >/dev/null 2>&1 || true
+ project_cmd exec "$NAME" -- rm -rf "/run/vdm-opencode-${SESSION_ID}" >/dev/null 2>&1 || true
+ project_cmd config unset "$NAME" user.vdm.session.id >/dev/null 2>&1 || true
+ project_cmd config unset "$NAME" user.vdm.session.expires_epoch >/dev/null 2>&1 || true
project_cmd exec "$NAME" -- rm -f \
"$AGENT_HOME/.local/share/opencode/auth.json" \
"$AGENT_HOME/.local/share/opencode/mcp-auth.json" >/dev/null 2>&1 || true
+ rm -f "$empty_env"
}
trap cleanup EXIT INT TERM
-project_cmd exec "$NAME" -- install -d -o "$AGENT_USER" -g "$AGENT_USER" -m 0700 "$GUEST_RUNTIME/data"
-
-log "Starting ephemeral OpenCode session in $NAME"
-project_cmd exec "$NAME" \
- "${EXEC_ENV[@]}" \
- --env "HOME=$AGENT_HOME" \
- --env "USER=$AGENT_USER" \
- --env "LOGNAME=$AGENT_USER" \
- --env "PATH=$AGENT_HOME/.local/bin:/usr/local/bin:/usr/bin:/bin" \
- --env "XDG_DATA_HOME=$GUEST_RUNTIME/data" \
- --env "VDM_GITEA_BASE_URL=$GITEA_BASE_URL" \
- --env "VDM_NEXTCLOUD_BASE_URL=$NEXTCLOUD_BASE_URL" \
- --env "VDM_GITHUB_BASE_URL=$GITHUB_BASE_URL" \
- --cwd "$WORKSPACE_ROOT" \
- -- runuser -u "$AGENT_USER" --preserve-environment -- "$AGENT_HOME/.local/bin/opencode"
+project_cmd exec "$NAME" -- install -d -o root -g root -m 0700 "$GUEST_INPUT_DIR"
+project_cmd file push --mode 0600 --uid 0 --gid 0 "$HOST_ENV_FILE" "$NAME$GUEST_CREDENTIAL"
+project_cmd config set "$NAME" user.vdm.session.id "$SESSION_ID"
+project_cmd config set "$NAME" user.vdm.session.expires_epoch "$EXPIRES_EPOCH"
+
+log "Starting isolated OpenCode session in $NAME (TTL: ${TTL_SECONDS}s)"
+project_cmd exec "$NAME" -- systemd-run \
+ --unit="$UNIT" \
+ --service-type=exec \
+ --pty \
+ --wait \
+ --collect \
+ --property="User=$AGENT_USER" \
+ --property="Group=$AGENT_USER" \
+ --property="WorkingDirectory=$WORKSPACE_ROOT" \
+ --property="RuntimeDirectory=vdm-opencode-${SESSION_ID}" \
+ --property="RuntimeDirectoryMode=0700" \
+ --property="RuntimeMaxSec=${TTL_SECONDS}s" \
+ --property="TimeoutStopSec=20s" \
+ --property="KillMode=control-group" \
+ --property="SendSIGKILL=yes" \
+ --property="UMask=0077" \
+ --property="NoNewPrivileges=yes" \
+ --property="PrivateTmp=yes" \
+ --property="ProtectControlGroups=yes" \
+ --property="ProtectKernelTunables=yes" \
+ --property="ProtectKernelModules=yes" \
+ --property="ProtectKernelLogs=yes" \
+ --property="RestrictSUIDSGID=yes" \
+ --property="LoadCredential=session.env:$GUEST_CREDENTIAL" \
+ --setenv="VDM_SESSION_ID=$SESSION_ID" \
+ --setenv="VDM_AGENT_HOME=$AGENT_HOME" \
+ --setenv="VDM_WORKSPACE_ROOT=$WORKSPACE_ROOT" \
+ --setenv="VDM_GITEA_BASE_URL=$GITEA_BASE_URL" \
+ --setenv="VDM_NEXTCLOUD_BASE_URL=$NEXTCLOUD_BASE_URL" \
+ --setenv="VDM_GITHUB_BASE_URL=$GITHUB_BASE_URL" \
+ /usr/local/libexec/vdm-opencode-session
diff --git a/scripts/stop-session.sh b/scripts/stop-session.sh
index 1087638..26d0243 100755
--- a/scripts/stop-session.sh
+++ b/scripts/stop-session.sh
@@ -7,6 +7,12 @@ source "$SCRIPT_DIR/lib/common.sh"
NAME="${1:-}"
[ -n "$NAME" ] || die "Usage: $0 INSTANCE_NAME"
-project_cmd exec "$NAME" -- pkill -u "$AGENT_USER" -x opencode >/dev/null 2>&1 || true
-project_cmd exec "$NAME" -- rm -rf /run/vdm-opencode-session >/dev/null 2>&1 || true
+# The single-quoted command is intentionally evaluated inside the guest.
+# shellcheck disable=SC2016
+project_cmd exec "$NAME" -- bash -c \
+ 'systemctl list-units --type=service --all --no-legend "vdm-opencode-*.service" |
+ awk "{print \$1}" | xargs -r systemctl stop' >/dev/null 2>&1 || true
+project_cmd exec "$NAME" -- rm -rf /run/vdm-opencode-input /run/vdm-opencode-* >/dev/null 2>&1 || true
+project_cmd config unset "$NAME" user.vdm.session.id >/dev/null 2>&1 || true
+project_cmd config unset "$NAME" user.vdm.session.expires_epoch >/dev/null 2>&1 || true
project_cmd stop "$NAME" --timeout 60
diff --git a/scripts/verify-artifact.sh b/scripts/verify-artifact.sh
new file mode 100755
index 0000000..a7569de
--- /dev/null
+++ b/scripts/verify-artifact.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+PACKAGE_DIR="${1:?package directory required}"
+[ -f "$PACKAGE_DIR/manifest.json" ] || { printf 'manifest.json is missing\n' >&2; exit 1; }
+[ -f "$PACKAGE_DIR/SHA256SUMS" ] || { printf 'SHA256SUMS is missing\n' >&2; exit 1; }
+(
+ cd "$PACKAGE_DIR"
+ sha256sum --check --strict SHA256SUMS
+)
+jq -e '
+ .schema == 2 and
+ (.artifact_id | type == "string") and
+ .platform == "vdm-opencode-platform" and
+ (.version | type == "string") and
+ (.variant | type == "string") and
+ (.architecture == "amd64" or .architecture == "arm64") and
+ (.payload | type == "array" and length > 0)
+' "$PACKAGE_DIR/manifest.json" >/dev/null
+if [ -f "$PACKAGE_DIR/SHA256SUMS.sigstore.json" ]; then
+ : "${COSIGN_PUBLIC_KEY:?COSIGN_PUBLIC_KEY is required to verify a signed artifact}"
+ cosign verify-blob \
+ --key "$COSIGN_PUBLIC_KEY" \
+ --bundle "$PACKAGE_DIR/SHA256SUMS.sigstore.json" \
+ "$PACKAGE_DIR/SHA256SUMS"
+fi
diff --git a/scripts/verify-image.sh b/scripts/verify-image.sh
index ef17dd1..6972741 100755
--- a/scripts/verify-image.sh
+++ b/scripts/verify-image.sh
@@ -26,6 +26,9 @@ project_cmd exec "$INSTANCE" -- test -f /etc/vdm-opencode-platform/build.json
project_cmd exec "$INSTANCE" -- jq -e --arg variant "$VARIANT" '.variant == $variant' /etc/vdm-opencode-platform/build.json >/dev/null
project_cmd exec "$INSTANCE" -- test ! -e "/home/$AGENT_USER/.local/share/opencode/auth.json"
project_cmd exec "$INSTANCE" -- test ! -e "/home/$AGENT_USER/.local/share/opencode/mcp-auth.json"
+project_cmd exec "$INSTANCE" -- test ! -e /opt/vdm-build
+project_cmd exec "$INSTANCE" -- test ! -s /etc/machine-id
+project_cmd exec "$INSTANCE" -- bash -c '! compgen -G "/etc/ssh/ssh_host_*" >/dev/null'
project_cmd exec "$INSTANCE" -- bash -c \
'! find /home/opencode -xdev -type f \( -name "id_rsa*" -o -name "id_ed25519*" -o -name ".git-credentials" \) -print -quit | grep -q .'
@@ -37,9 +40,9 @@ assert_version \
assert_version \
"Git MCP" \
"$GIT_MCP_EXPECTED_VERSION" \
- "$(guest_output "/home/$AGENT_USER/.local/share/uv/tools/mcp-server-git/bin/python" -c 'import importlib.metadata; print(importlib.metadata.version("mcp-server-git"))' | tr -d '[:space:]')"
+ "$(guest_output "/home/$AGENT_USER/.local/share/pipx/venvs/mcp-server-git/bin/python" -c 'import importlib.metadata; print(importlib.metadata.version("mcp-server-git"))' | tr -d '[:space:]')"
-if [ "$VARIANT" = php ] || [ "$VARIANT" = typescript ] || [ "$VARIANT" = full ]; then
+if image_has_component "$VARIANT" browser; then
assert_version \
Playwright \
"$PLAYWRIGHT_EXPECTED_VERSION" \
@@ -52,7 +55,12 @@ if [ "$VARIANT" = php ] || [ "$VARIANT" = typescript ] || [ "$VARIANT" = full ];
project_cmd exec "$INSTANCE" -- test -d /opt/ms-playwright
fi
-if [ "$VARIANT" = python ] || [ "$VARIANT" = full ]; then
+if image_has_component "$VARIANT" typescript; then
+ assert_version TypeScript "$TYPESCRIPT_EXPECTED_VERSION" "$(guest_output tsc --version | awk '{print $2}')"
+ assert_version TSX "$TSX_EXPECTED_VERSION" "$(guest_output tsx --version | awk 'NR == 1 {print $2}')"
+fi
+
+if image_has_component "$VARIANT" python; then
assert_version Ruff "$RUFF_EXPECTED_VERSION" "$(guest_output "/home/$AGENT_USER/.local/bin/ruff" --version | awk '{print $2}')"
assert_version mypy "$MYPY_EXPECTED_VERSION" "$(guest_output "/home/$AGENT_USER/.local/bin/mypy" --version | awk '{print $2}')"
fi
diff --git a/security/README.md b/security/README.md
new file mode 100644
index 0000000..885ed5c
--- /dev/null
+++ b/security/README.md
@@ -0,0 +1,9 @@
+# Release signing
+
+Production releases use Cosign with an OpenBao Transit key:
+`openbao://vdm-opencode-release`. Export the public verification key to the
+secured deployment configuration and pass its path as `COSIGN_PUBLIC_KEY`.
+
+The private key must never leave OpenBao. CI receives a short-lived,
+sign-only OpenBao token through its runtime secret store. Private repository
+builds disable public transparency-log upload to avoid disclosing digests.
diff --git a/security/vulnerability-policy.yaml b/security/vulnerability-policy.yaml
new file mode 100644
index 0000000..d9af1b7
--- /dev/null
+++ b/security/vulnerability-policy.yaml
@@ -0,0 +1,5 @@
+schema: 1
+rules:
+ fail_critical: true
+ fail_high_when_fixed: true
+waivers: []
diff --git a/tests/fixtures/session/incus b/tests/fixtures/session/incus
new file mode 100755
index 0000000..fdb571d
--- /dev/null
+++ b/tests/fixtures/session/incus
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+
+if [ "${1:-}" = info ]; then
+ exit 0
+fi
+if [ "${1:-}" = --project ]; then
+ shift 2
+fi
+
+printf '%q ' "$@" >> "${MOCK_INCUS_LOG:?MOCK_INCUS_LOG is required}"
+printf '\n' >> "$MOCK_INCUS_LOG"
+
+case "${1:-}:${2:-}" in
+ list:--format)
+ cat "${MOCK_INCUS_LIST:?MOCK_INCUS_LIST is required for list}"
+ ;;
+ info:*|start:*|stop:*|config:set|config:unset|file:push|exec:*)
+ exit 0
+ ;;
+ *)
+ printf 'Unexpected session mock Incus invocation: %s\n' "$*" >&2
+ exit 1
+ ;;
+esac
diff --git a/tests/generated-platform.sh b/tests/generated-platform.sh
new file mode 100755
index 0000000..39d56d3
--- /dev/null
+++ b/tests/generated-platform.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
+
+python3 "$ROOT_DIR/scripts/generate-platform.py" --check
+# shellcheck disable=SC1091
+source "$ROOT_DIR/scripts/lib/common.sh"
+
+for image in "${PLATFORM_IMAGES[@]}"; do
+ variant_exists "$image"
+ test -f "$ROOT_DIR/incus/profiles/generated/images/$image.yaml"
+ for component in ${PLATFORM_IMAGE_COMPONENTS[$image]}; do
+ provision="${PLATFORM_COMPONENT_PROVISION[$component]:-}"
+ [ -z "$provision" ] || test -f "$ROOT_DIR/image/provision/$provision"
+ done
+done
+
+for policy in "${!PLATFORM_POLICY_STATUS[@]}"; do
+ test -f "$ROOT_DIR/incus/profiles/generated/policies/$policy.yaml"
+ test -f "$ROOT_DIR/incus/acls/generated/$policy.yaml"
+done
+for size in "${!PLATFORM_SIZE_CPUS[@]}"; do
+ test -f "$ROOT_DIR/incus/profiles/generated/sizes/$size.yaml"
+done
+
+github="$(python3 "$ROOT_DIR/scripts/generate-platform.py" --matrix github)"
+gitea="$(python3 "$ROOT_DIR/scripts/generate-platform.py" --matrix gitea)"
+[ "$github" = "$gitea" ]
+printf 'Generated platform tests passed.\n'
diff --git a/tests/package-roundtrip.sh b/tests/package-roundtrip.sh
index 96b000b..4822c6d 100755
--- a/tests/package-roundtrip.sh
+++ b/tests/package-roundtrip.sh
@@ -12,10 +12,12 @@ output_dir="$tmp_dir/package"
"$ROOT_DIR/scripts/package-image.sh" base "$output_dir"
jq -e '
- .schema == 1 and
+ .schema == 2 and
.platform == "vdm-opencode-platform" and
- .version == "0.2.0" and
+ .version == "0.3.0-rc.1" and
.variant == "base" and
+ .architecture == "amd64" and
+ .artifact_id == "vdm-opencode-base-0.3.0-rc.1-amd64" and
(.payload | length == 2)
' "$output_dir/manifest.json" >/dev/null
@@ -27,4 +29,10 @@ jq -e '
"$ROOT_DIR/scripts/import-image-package.sh" "$output_dir" "vdm-opencode-base/test"
grep -Eq 'image import .*\.tar .*\.rootfs --alias vdm-opencode-base/test' "$MOCK_INCUS_LOG"
+printf 'tampered\n' >> "$(find "$output_dir/payload" -type f | head -n 1)"
+if "$ROOT_DIR/scripts/verify-artifact.sh" "$output_dir" >/dev/null 2>&1; then
+ printf 'Tampered payload should have been rejected.\n' >&2
+ exit 1
+fi
+
printf 'Image package round-trip test passed.\n'
diff --git a/tests/reaper.sh b/tests/reaper.sh
new file mode 100755
index 0000000..fdaaeac
--- /dev/null
+++ b/tests/reaper.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
+tmp_dir="$(mktemp -d)"
+trap 'rm -rf "$tmp_dir"' EXIT
+
+export PATH="$ROOT_DIR/tests/fixtures/session:$PATH"
+export MOCK_INCUS_LOG="$tmp_dir/incus.log"
+export MOCK_INCUS_LIST="$tmp_dir/list.json"
+cat > "$MOCK_INCUS_LIST" <<'JSON'
+[
+ {"name":"expired","status":"Running","config":{"user.vdm.session.expires_epoch":"100"}},
+ {"name":"unexpired","status":"Running","config":{"user.vdm.session.expires_epoch":"300"}},
+ {"name":"malformed","status":"Running","config":{"user.vdm.session.expires_epoch":"tomorrow"}},
+ {"name":"no-expiry","status":"Running","config":{}},
+ {"name":"already-stopped","status":"Stopped","config":{"user.vdm.session.expires_epoch":"50"}}
+]
+JSON
+
+VDM_REAPER_NOW=200 "$ROOT_DIR/scripts/reap-expired-vms.sh"
+grep -E '^stop expired ' "$MOCK_INCUS_LOG" >/dev/null
+if grep -E '^stop (unexpired|malformed|no-expiry|already-stopped) ' "$MOCK_INCUS_LOG"; then
+ printf 'Reaper stopped a VM that should have remained untouched.\n' >&2
+ exit 1
+fi
+
+# Simulate Incus state after the first stop and prove a second pass is a no-op.
+printf '[{"name":"expired","status":"Stopped","config":{}}]\n' > "$MOCK_INCUS_LIST"
+: > "$MOCK_INCUS_LOG"
+VDM_REAPER_NOW=200 "$ROOT_DIR/scripts/reap-expired-vms.sh"
+if grep -E '^stop ' "$MOCK_INCUS_LOG"; then
+ printf 'Second reaper pass was not idempotent.\n' >&2
+ exit 1
+fi
+printf 'VM expiry reaper tests passed.\n'
diff --git a/tests/security-static.py b/tests/security-static.py
new file mode 100644
index 0000000..0356da6
--- /dev/null
+++ b/tests/security-static.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python3
+from __future__ import annotations
+
+import unittest
+from pathlib import Path
+
+import yaml
+
+
+ROOT = Path(__file__).resolve().parents[1]
+
+
+class SecurityStaticTest(unittest.TestCase):
+ def test_incus_project_restrictions(self) -> None:
+ project = yaml.safe_load((ROOT / "incus/projects/vdm-agents.yaml").read_text())
+ config = project["config"]
+ self.assertEqual("true", config["restricted"])
+ self.assertEqual("managed", config["restricted.devices.disk"])
+ self.assertEqual("managed", config["restricted.devices.nic"])
+ for key in (
+ "restricted.devices.gpu",
+ "restricted.devices.pci",
+ "restricted.devices.proxy",
+ "restricted.devices.usb",
+ "restricted.virtual-machines.lowlevel",
+ ):
+ self.assertEqual("block", config[key])
+
+ def test_generated_network_profiles_fail_closed(self) -> None:
+ for path in (ROOT / "incus/profiles/generated/policies").glob("*.yaml"):
+ profile = yaml.safe_load(path.read_text())
+ nic = profile["devices"]["eth0"]
+ self.assertEqual("reject", nic["security.acls.default.ingress.action"])
+ self.assertEqual("reject", nic["security.acls.default.egress.action"])
+ self.assertEqual("true", nic["security.ipv4_filtering"])
+
+ def test_connected_policy_denies_private_networks_before_public_allow(self) -> None:
+ acl = yaml.safe_load((ROOT / "incus/acls/generated/connected.yaml").read_text())
+ rules = acl["egress"]
+ final_allow = max(index for index, rule in enumerate(rules) if rule["action"] == "allow")
+ for network in ("10.0.0.0/8", "100.64.0.0/10", "169.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16"):
+ index = next(i for i, rule in enumerate(rules) if rule.get("destination") == network)
+ self.assertLess(index, final_allow)
+ self.assertEqual("reject", rules[index]["action"])
+
+ def test_session_secrets_do_not_enter_incus_arguments(self) -> None:
+ session = (ROOT / "scripts/start-session.sh").read_text()
+ self.assertNotIn('--env "$line"', session)
+ self.assertIn("LoadCredential=session.env:", session)
+ self.assertIn("RuntimeMaxSec=", session)
+ self.assertIn("KillMode=control-group", session)
+ self.assertIn("user.vdm.session.expires_epoch", session)
+ for forbidden in ("OPENAI_API_KEY", "ANTHROPIC_API_KEY", "GEMINI_API_KEY", "XAI_API_KEY", "LD_PRELOAD", "BASH_ENV"):
+ self.assertNotIn(forbidden, session)
+
+ def test_all_provider_routes_exist(self) -> None:
+ config = yaml.safe_load((ROOT / "broker/config/litellm.yaml").read_text())
+ routes = {entry["model_name"] for entry in config["model_list"]}
+ self.assertEqual(
+ {"openai-default", "anthropic-default", "gemini-default", "xai-default", "local-default"},
+ routes,
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/session-secret-transport.sh b/tests/session-secret-transport.sh
new file mode 100755
index 0000000..82b685e
--- /dev/null
+++ b/tests/session-secret-transport.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
+tmp_dir="$(mktemp -d)"
+trap 'rm -rf "$tmp_dir"' EXIT
+
+export PATH="$ROOT_DIR/tests/fixtures/session:$PATH"
+export MOCK_INCUS_LOG="$tmp_dir/incus.log"
+export MOCK_INCUS_LIST="$tmp_dir/list.json"
+printf '[]\n' > "$MOCK_INCUS_LIST"
+runtime_file="$tmp_dir/runtime.env"
+sentinel="never-appear-in-incus-argv-7f3d9a"
+printf 'GITHUB_MCP_TOKEN=%s\n' "$sentinel" > "$runtime_file"
+chmod 0600 "$runtime_file"
+
+"$ROOT_DIR/scripts/start-session.sh" test-vm "$runtime_file" 60s
+if grep -F "$sentinel" "$MOCK_INCUS_LOG"; then
+ printf 'Secret value leaked into an Incus process argument.\n' >&2
+ exit 1
+fi
+grep -F 'LoadCredential=session.env:' "$MOCK_INCUS_LOG" >/dev/null
+printf 'Session secret transport test passed.\n'
diff --git a/tests/test_platform_manifest.py b/tests/test_platform_manifest.py
new file mode 100644
index 0000000..8a9596d
--- /dev/null
+++ b/tests/test_platform_manifest.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python3
+from __future__ import annotations
+
+import json
+import subprocess
+import unittest
+from pathlib import Path
+
+import yaml
+
+
+ROOT = Path(__file__).resolve().parents[1]
+MANIFEST = ROOT / "manifest/images.yaml"
+GENERATOR = ROOT / "scripts/generate-platform.py"
+
+
+class PlatformManifestTest(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls) -> None:
+ cls.data = yaml.safe_load(MANIFEST.read_text(encoding="utf-8"))
+
+ def test_authority_and_ownership(self) -> None:
+ self.assertEqual(2, self.data["schema"])
+ platform = self.data["platform"]
+ self.assertEqual((ROOT / "VERSION").read_text(encoding="utf-8").strip(), platform["version"])
+ self.assertEqual("GPL-3.0-only", platform["license"])
+ self.assertEqual("Vast Development Method", platform["copyright"]["holder"])
+
+ def test_supported_languages_are_intentional(self) -> None:
+ languages = set(self.data["dimensions"]["languages"])
+ self.assertTrue({"shell", "php", "python", "node", "typescript", "c", "cpp"} <= languages)
+ self.assertFalse({"rust", "go", "java"} & languages)
+
+ def test_capability_policy_and_size_catalogs(self) -> None:
+ dimensions = self.data["dimensions"]
+ self.assertTrue({"cpu", "browser", "database", "android", "gpu"} <= set(dimensions["capabilities"]))
+ self.assertGreaterEqual(len(dimensions["policies"]), 5)
+ self.assertGreaterEqual(len(dimensions["sizes"]), 5)
+ self.assertEqual("planned", dimensions["capabilities"]["android"]["status"])
+ self.assertEqual("planned", dimensions["capabilities"]["gpu"]["status"])
+
+ def test_provider_matrices_are_identical_and_complete(self) -> None:
+ outputs = []
+ for provider in ("github", "gitea"):
+ result = subprocess.run(
+ ["python3", str(GENERATOR), "--matrix", provider],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+ outputs.append(json.loads(result.stdout))
+ self.assertEqual(outputs[0], outputs[1])
+ expected = {
+ (name, architecture)
+ for architecture, spec in self.data["platform"]["architectures"].items()
+ if spec["release"]
+ for name, image in self.data["images"].items()
+ if image["release"]
+ }
+ actual = {(entry["variant"], entry["architecture"]) for entry in outputs[0]["include"]}
+ self.assertEqual(expected, actual)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/validate-repository.sh b/tests/validate-repository.sh
index 6ccff56..add0876 100755
--- a/tests/validate-repository.sh
+++ b/tests/validate-repository.sh
@@ -5,19 +5,33 @@ ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
fail=0
find_args=("$ROOT_DIR" -type f -not -path "$ROOT_DIR/.git/*" -not -path "$ROOT_DIR/build/*")
+extra_shell=(
+ "$ROOT_DIR/image/files/usr/local/libexec/vdm-opencode-session"
+ "$ROOT_DIR/tests/fixtures/incus"
+ "$ROOT_DIR/tests/fixtures/session/incus"
+)
while IFS= read -r -d '' script; do
bash -n "$script" || fail=1
done < <(find "${find_args[@]}" -name '*.sh' -print0)
+for script in "${extra_shell[@]}"; do
+ bash -n "$script" || fail=1
+done
if command -v shellcheck >/dev/null 2>&1; then
mapfile -d '' scripts < <(find "${find_args[@]}" -name '*.sh' -print0)
if (("${#scripts[@]}" > 0)); then
- shellcheck -x "${scripts[@]}" || fail=1
+ shellcheck -x "${scripts[@]}" "${extra_shell[@]}" || fail=1
fi
fi
bash "$ROOT_DIR/tests/variant-selection.sh" || fail=1
+python3 "$ROOT_DIR/scripts/generate-platform.py" --check || fail=1
+python3 -m unittest "$ROOT_DIR/tests/test_platform_manifest.py" || fail=1
+python3 -m unittest "$ROOT_DIR/tests/security-static.py" || fail=1
+bash "$ROOT_DIR/tests/generated-platform.sh" || fail=1
+bash "$ROOT_DIR/tests/session-secret-transport.sh" || fail=1
+bash "$ROOT_DIR/tests/reaper.sh" || fail=1
if command -v make >/dev/null 2>&1; then
make -C "$ROOT_DIR" --dry-run help local-release >/dev/null || fail=1
@@ -59,6 +73,16 @@ if grep -RIE '\$\{\{[[:space:]]*github\.' "$ROOT_DIR/.gitea/workflows"; then
fail=1
fi
+if grep -RIE 'variant:[[:space:]]*\[' "$ROOT_DIR/.github/workflows" "$ROOT_DIR/.gitea/workflows"; then
+ printf 'A workflow contains a hand-maintained image matrix.\n' >&2
+ fail=1
+fi
+
+if grep -RIE 'curl[^|]*\|[[:space:]]*(bash|sh)' "$ROOT_DIR/image" "$ROOT_DIR/scripts"; then
+ printf 'A network-delivered script is executed without a pinned intermediate file.\n' >&2
+ fail=1
+fi
+
if grep -RIE \
--exclude-dir=.git \
--exclude='*.md' \
diff --git a/tests/variant-selection.sh b/tests/variant-selection.sh
old mode 100644
new mode 100755
index 795824e..bcb4184
--- a/tests/variant-selection.sh
+++ b/tests/variant-selection.sh
@@ -27,7 +27,7 @@ assert_rejected() {
fi
}
-assert_selection "all" "base php python cpp typescript full"
+assert_selection "all" "${PLATFORM_RELEASE_IMAGES[*]}"
assert_selection "php,typescript,full" "php typescript full"
assert_selection $'php typescript\nfull' "php typescript full"
assert_selection "php,php,full" "php full"