afyx-engineering-kit 0.1.0-alpha.4 → 0.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.afyx-source-revision +1 -1
- package/README.md +12 -0
- package/afyx-graph/engine/release/RELEASE-MANIFEST.json +3 -3
- package/afyx-graph/engine/release/SHA256SUMS +2 -2
- package/afyx-graph/engine/release/afyx-graph-linux-x64.tar.gz +0 -0
- package/afyx-graph/engine/release/afyx-graph-win32-x64.zip +0 -0
- package/bin/afyx-engineering-kit.mjs +22 -1
- package/install.ps1 +84 -13
- package/install.sh +81 -1
- package/package.json +2 -1
- package/scripts/afyx-install-backend.mjs +46 -0
- package/scripts/afyx-install-contract.mjs +139 -0
- package/scripts/afyx-midnight-circuit.mjs +328 -0
- package/scripts/afyx-npm-installer.mjs +27 -5
- package/scripts/install-afyx-graph.ps1 +75 -29
- package/scripts/lib/AfyxPlatform.ps1 +133 -0
- package/scripts/lib/AfyxPlatform.psm1 +6 -0
- package/scripts/package-release-zip.ps1 +124 -0
- package/scripts/validate-release-zip-graph.mjs +55 -0
- package/verify.ps1 +25 -9
- package/verify.sh +9 -1
- package/afyx-context/test-fixtures/coordination-worker.mjs +0 -52
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/__init__.py +0 -1
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/__manifest__.py +0 -4
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/models/__init__.py +0 -1
- package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/models/sale_order.py +0 -5
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/__init__.py +0 -1
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/__manifest__.py +0 -10
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/__init__.py +0 -2
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/sale_order.py +0 -20
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/models/sale_order_audit.py +0 -11
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/security/ir.model.access.csv +0 -2
- package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/views/sale_order_views.xml +0 -14
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# AfyxPlatform.ps1 — Shared Windows and cross-platform architecture detection helper
|
|
2
|
+
# Compatible with Windows PowerShell 5.1, PowerShell 7+, and Set-StrictMode -Version Latest.
|
|
3
|
+
|
|
4
|
+
Set-StrictMode -Version Latest
|
|
5
|
+
|
|
6
|
+
function Get-AfyxOperatingSystemArchitecture {
|
|
7
|
+
<#
|
|
8
|
+
.SYNOPSIS
|
|
9
|
+
Detects the physical/host Windows OS architecture safely without failing on missing .NET APIs.
|
|
10
|
+
.OUTPUTS
|
|
11
|
+
[string] 'x64', 'arm64', 'x86', or 'unknown'
|
|
12
|
+
#>
|
|
13
|
+
[CmdletBinding()]
|
|
14
|
+
param()
|
|
15
|
+
|
|
16
|
+
# 1. Safely inspect RuntimeInformation via reflection to avoid PropertyNotFoundStrict in PS 5.1
|
|
17
|
+
try {
|
|
18
|
+
$rtType = [Type]::GetType('System.Runtime.InteropServices.RuntimeInformation, System.Runtime.InteropServices.RuntimeInformation', $false)
|
|
19
|
+
if (-not $rtType) {
|
|
20
|
+
$rtType = [Type]::GetType('System.Runtime.InteropServices.RuntimeInformation', $false)
|
|
21
|
+
}
|
|
22
|
+
if ($rtType) {
|
|
23
|
+
$prop = $rtType.GetProperty('OSArchitecture')
|
|
24
|
+
if ($prop) {
|
|
25
|
+
$val = $prop.GetValue($null, $null)
|
|
26
|
+
if ($val) {
|
|
27
|
+
$strVal = $val.ToString().ToUpperInvariant()
|
|
28
|
+
switch ($strVal) {
|
|
29
|
+
'X64' { return 'x64' }
|
|
30
|
+
'ARM64' { return 'arm64' }
|
|
31
|
+
'X86' { return 'x86' }
|
|
32
|
+
'ARM' { return 'arm' }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} catch {
|
|
38
|
+
# Fall through to environment inspection
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# 2. Check PROCESSOR_ARCHITEW6432 (set when a 32-bit process runs on 64-bit OS) then PROCESSOR_ARCHITECTURE
|
|
42
|
+
$archCandidate = $env:PROCESSOR_ARCHITEW6432
|
|
43
|
+
if (-not $archCandidate) {
|
|
44
|
+
$archCandidate = $env:PROCESSOR_ARCHITECTURE
|
|
45
|
+
}
|
|
46
|
+
if ($archCandidate) {
|
|
47
|
+
$norm = $archCandidate.Trim().ToUpperInvariant()
|
|
48
|
+
switch ($norm) {
|
|
49
|
+
'AMD64' { return 'x64' }
|
|
50
|
+
'ARM64' { return 'arm64' }
|
|
51
|
+
'X86' {
|
|
52
|
+
try {
|
|
53
|
+
if ([System.Environment]::Is64BitOperatingSystem) { return 'x64' }
|
|
54
|
+
} catch { }
|
|
55
|
+
return 'x86'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
# 3. Fallback via CIM / WMI
|
|
61
|
+
try {
|
|
62
|
+
$cs = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue
|
|
63
|
+
if ($cs -and $cs.OSArchitecture) {
|
|
64
|
+
$desc = $cs.OSArchitecture.ToString()
|
|
65
|
+
if ($desc -match 'ARM') { return 'arm64' }
|
|
66
|
+
if ($desc -match '64') { return 'x64' }
|
|
67
|
+
if ($desc -match '32') { return 'x86' }
|
|
68
|
+
}
|
|
69
|
+
} catch { }
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
if ([System.Environment]::Is64BitOperatingSystem) { return 'x64' }
|
|
73
|
+
} catch { }
|
|
74
|
+
|
|
75
|
+
return 'unknown'
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function Get-AfyxPlatformDescription {
|
|
79
|
+
<#
|
|
80
|
+
.SYNOPSIS
|
|
81
|
+
Returns a formatted OS and architecture description string (e.g. 'Microsoft Windows 11 / X64').
|
|
82
|
+
#>
|
|
83
|
+
[CmdletBinding()]
|
|
84
|
+
param()
|
|
85
|
+
|
|
86
|
+
$osDesc = $null
|
|
87
|
+
try {
|
|
88
|
+
$rtType = [Type]::GetType('System.Runtime.InteropServices.RuntimeInformation, System.Runtime.InteropServices.RuntimeInformation', $false)
|
|
89
|
+
if (-not $rtType) {
|
|
90
|
+
$rtType = [Type]::GetType('System.Runtime.InteropServices.RuntimeInformation', $false)
|
|
91
|
+
}
|
|
92
|
+
if ($rtType) {
|
|
93
|
+
$prop = $rtType.GetProperty('OSDescription')
|
|
94
|
+
if ($prop) {
|
|
95
|
+
$val = $prop.GetValue($null, $null)
|
|
96
|
+
if ($val) { $osDesc = [string]$val }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} catch { }
|
|
100
|
+
|
|
101
|
+
if (-not $osDesc) {
|
|
102
|
+
try {
|
|
103
|
+
$cs = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue
|
|
104
|
+
if ($cs -and $cs.Caption) {
|
|
105
|
+
$osDesc = "$($cs.Caption) $($cs.Version)"
|
|
106
|
+
}
|
|
107
|
+
} catch { }
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (-not $osDesc) {
|
|
111
|
+
$osDesc = [System.Environment]::OSVersion.VersionString
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
$arch = (Get-AfyxOperatingSystemArchitecture).ToUpperInvariant()
|
|
115
|
+
return "$osDesc / $arch"
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function Get-AfyxGraphTarget {
|
|
119
|
+
<#
|
|
120
|
+
.SYNOPSIS
|
|
121
|
+
Maps the detected OS architecture to the canonical Afyx Graph target string.
|
|
122
|
+
#>
|
|
123
|
+
[CmdletBinding()]
|
|
124
|
+
param()
|
|
125
|
+
|
|
126
|
+
$arch = Get-AfyxOperatingSystemArchitecture
|
|
127
|
+
switch ($arch) {
|
|
128
|
+
'x64' { return 'win32-x64' }
|
|
129
|
+
'arm64' { return 'win32-arm64' }
|
|
130
|
+
'x86' { return 'win32-x86' }
|
|
131
|
+
default { return "win32-$arch" }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# AfyxPlatform.psm1 — Shared Windows and cross-platform architecture detection module
|
|
2
|
+
# Compatible with Windows PowerShell 5.1, PowerShell 7+, and Set-StrictMode -Version Latest.
|
|
3
|
+
|
|
4
|
+
. (Join-Path $PSScriptRoot 'AfyxPlatform.ps1')
|
|
5
|
+
|
|
6
|
+
Export-ModuleMember -Function Get-AfyxOperatingSystemArchitecture, Get-AfyxPlatformDescription, Get-AfyxGraphTarget
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
[CmdletBinding()]
|
|
2
|
+
param(
|
|
3
|
+
[string]$OutputDir = (Join-Path $PSScriptRoot '..\testing\integration\release-zip'),
|
|
4
|
+
[string]$Revision = '',
|
|
5
|
+
[string]$GraphReleaseDir = '',
|
|
6
|
+
[switch]$BuildGraphFromSource
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
Set-StrictMode -Version Latest
|
|
10
|
+
$ErrorActionPreference = 'Stop'
|
|
11
|
+
$kitRoot = Split-Path -Parent $PSScriptRoot
|
|
12
|
+
$validator = Join-Path $PSScriptRoot 'validate-release-zip-graph.mjs'
|
|
13
|
+
$stageDir = $null
|
|
14
|
+
|
|
15
|
+
function Invoke-Required([string]$Program, [string[]]$Arguments) {
|
|
16
|
+
$global:LASTEXITCODE = 0
|
|
17
|
+
$output = & $Program @Arguments 2>&1
|
|
18
|
+
if ($LASTEXITCODE -ne 0) { throw "$Program failed ($LASTEXITCODE): $($output -join ' ')" }
|
|
19
|
+
return $output
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (-not $Revision) { $Revision = (Invoke-Required 'git' @('-C', $kitRoot, 'rev-parse', 'HEAD') | Select-Object -Last 1).Trim() }
|
|
23
|
+
if ($Revision -cnotmatch '^[0-9a-f]{40}$') { throw 'Revision must be an exact 40-character Git commit SHA.' }
|
|
24
|
+
$resolved = (Invoke-Required 'git' @('-C', $kitRoot, 'rev-parse', '--verify', "$Revision^{commit}") | Select-Object -Last 1).Trim()
|
|
25
|
+
if ($resolved -cne $Revision) { throw 'Revision does not identify the selected Git commit.' }
|
|
26
|
+
$head = (Invoke-Required 'git' @('-C', $kitRoot, 'rev-parse', 'HEAD') | Select-Object -Last 1).Trim()
|
|
27
|
+
if ($head -cne $Revision) { throw 'Package only the current HEAD; switch to the selected immutable commit first.' }
|
|
28
|
+
if (Invoke-Required 'git' @('-C', $kitRoot, 'status', '--porcelain')) { throw 'Source checkout is dirty; commit or use a clean worktree before packaging.' }
|
|
29
|
+
|
|
30
|
+
if (-not $GraphReleaseDir) { $GraphReleaseDir = Join-Path $kitRoot 'afyx-graph\engine\release' }
|
|
31
|
+
if ($BuildGraphFromSource) {
|
|
32
|
+
Invoke-Required 'node' @($validator, 'build', '--root', $kitRoot, '--revision', $Revision) | Out-Null
|
|
33
|
+
}
|
|
34
|
+
Invoke-Required 'node' @($validator, 'verify', '--release', $GraphReleaseDir, '--revision', $Revision, '--root', $kitRoot) | Out-Null
|
|
35
|
+
|
|
36
|
+
$stageDir = Join-Path ([IO.Path]::GetTempPath()) ("afyx-zip-stage-" + [guid]::NewGuid().ToString('N'))
|
|
37
|
+
try {
|
|
38
|
+
$sourceDir = Join-Path $stageDir 'source'
|
|
39
|
+
$kitStage = Join-Path $stageDir 'afyx-engineering-kit'
|
|
40
|
+
[IO.Directory]::CreateDirectory($sourceDir) | Out-Null
|
|
41
|
+
[IO.Directory]::CreateDirectory($kitStage) | Out-Null
|
|
42
|
+
$sourceTar = Join-Path $stageDir 'source.tar'
|
|
43
|
+
Invoke-Required 'git' @('-C', $kitRoot, 'archive', '--format=tar', "--output=$sourceTar", $Revision) | Out-Null
|
|
44
|
+
Invoke-Required 'tar' @('-xf', $sourceTar, '-C', $sourceDir) | Out-Null
|
|
45
|
+
|
|
46
|
+
$items = @('bin', 'scripts', 'skills', 'afyx-context', 'afyx-forge', 'tools',
|
|
47
|
+
'install.ps1', 'install.sh', 'verify.ps1', 'verify.sh', 'update.ps1', 'update.sh',
|
|
48
|
+
'uninstall.ps1', 'uninstall.sh', 'package.json', 'LICENSE', 'README.md', 'SECURITY.md')
|
|
49
|
+
foreach ($item in $items) {
|
|
50
|
+
$from = Join-Path $sourceDir $item
|
|
51
|
+
if (-not (Test-Path -LiteralPath $from)) { throw "Committed source is missing required package item: $item" }
|
|
52
|
+
Copy-Item -LiteralPath $from -Destination (Join-Path $kitStage $item) -Recurse -Force
|
|
53
|
+
}
|
|
54
|
+
$stageRoot = [IO.Path]::GetFullPath($kitStage).TrimEnd([IO.Path]::DirectorySeparatorChar) + [IO.Path]::DirectorySeparatorChar
|
|
55
|
+
foreach ($relative in @('scripts\tests', 'afyx-context\test', 'afyx-context\test-fixtures', 'afyx-context\benchmark',
|
|
56
|
+
'afyx-forge\test', 'tools\codex-usage\tests')) {
|
|
57
|
+
$target = [IO.Path]::GetFullPath((Join-Path $kitStage $relative))
|
|
58
|
+
if (-not $target.StartsWith($stageRoot, [StringComparison]::OrdinalIgnoreCase)) { throw 'Unsafe staging path' }
|
|
59
|
+
if (Test-Path -LiteralPath $target) { Remove-Item -LiteralPath $target -Recurse -Force }
|
|
60
|
+
}
|
|
61
|
+
$graphStage = Join-Path $kitStage 'afyx-graph'
|
|
62
|
+
[IO.Directory]::CreateDirectory($graphStage) | Out-Null
|
|
63
|
+
Copy-Item -LiteralPath (Join-Path $sourceDir 'afyx-graph\afyx-graph.json') -Destination $graphStage
|
|
64
|
+
$engineStage = Join-Path $graphStage 'engine'
|
|
65
|
+
[IO.Directory]::CreateDirectory($engineStage) | Out-Null
|
|
66
|
+
$engineScripts = Join-Path $engineStage 'scripts'
|
|
67
|
+
[IO.Directory]::CreateDirectory($engineScripts) | Out-Null
|
|
68
|
+
foreach ($name in @('distribution-contract.mjs', 'distribution-product.json')) {
|
|
69
|
+
Copy-Item -LiteralPath (Join-Path $sourceDir "afyx-graph\engine\scripts\$name") -Destination $engineScripts
|
|
70
|
+
}
|
|
71
|
+
$releaseStage = Join-Path $engineStage 'release'
|
|
72
|
+
[IO.Directory]::CreateDirectory($releaseStage) | Out-Null
|
|
73
|
+
foreach ($name in @('afyx-graph-win32-x64.zip', 'RELEASE-MANIFEST.json', 'SHA256SUMS')) {
|
|
74
|
+
Copy-Item -LiteralPath (Join-Path $GraphReleaseDir $name) -Destination $releaseStage
|
|
75
|
+
}
|
|
76
|
+
[IO.File]::WriteAllText((Join-Path $kitStage '.afyx-source-revision'), "$Revision`n", [Text.UTF8Encoding]::new($false))
|
|
77
|
+
|
|
78
|
+
$version = (Get-Content -Raw -LiteralPath (Join-Path $sourceDir 'package.json') | ConvertFrom-Json).version
|
|
79
|
+
$name = "afyx-engineering-kit-v$version-windows-x64.zip"
|
|
80
|
+
$tempZip = Join-Path $stageDir $name
|
|
81
|
+
$timestamp = [datetime]::SpecifyKind([datetime]'2020-01-01', [DateTimeKind]::Utc)
|
|
82
|
+
Get-ChildItem -LiteralPath $kitStage -Recurse -Force | ForEach-Object { $_.LastWriteTimeUtc = $timestamp }
|
|
83
|
+
(Get-Item -LiteralPath $kitStage).LastWriteTimeUtc = $timestamp
|
|
84
|
+
Add-Type -AssemblyName System.IO.Compression
|
|
85
|
+
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
86
|
+
$writer = [IO.Compression.ZipFile]::Open($tempZip, [IO.Compression.ZipArchiveMode]::Create)
|
|
87
|
+
try {
|
|
88
|
+
foreach ($file in (Get-ChildItem -LiteralPath $kitStage -Recurse -Force -File | Sort-Object FullName)) {
|
|
89
|
+
$relative = $file.FullName.Substring($kitStage.Length).TrimStart([char[]]@('\', '/')).Replace('\', '/')
|
|
90
|
+
$entryName = "afyx-engineering-kit/$relative"
|
|
91
|
+
[IO.Compression.ZipFileExtensions]::CreateEntryFromFile($writer, $file.FullName, $entryName, [IO.Compression.CompressionLevel]::Optimal) | Out-Null
|
|
92
|
+
}
|
|
93
|
+
} finally { $writer.Dispose() }
|
|
94
|
+
$zip = [IO.Compression.ZipFile]::OpenRead($tempZip)
|
|
95
|
+
try {
|
|
96
|
+
$required = @("afyx-engineering-kit/.afyx-source-revision", "afyx-engineering-kit/install.ps1",
|
|
97
|
+
"afyx-engineering-kit/verify.ps1", "afyx-engineering-kit/afyx-graph/engine/release/afyx-graph-win32-x64.zip")
|
|
98
|
+
foreach ($entryName in $required) {
|
|
99
|
+
if (-not $zip.GetEntry($entryName)) { throw "Release ZIP is missing $entryName" }
|
|
100
|
+
}
|
|
101
|
+
foreach ($forbidden in @('scripts/tests/', 'afyx-context/test/', 'afyx-context/test-fixtures/', 'afyx-context/benchmark/',
|
|
102
|
+
'afyx-forge/test/', 'tools/codex-usage/tests/', 'afyx-graph/engine/scripts/tests/')) {
|
|
103
|
+
if ($zip.Entries.FullName | Where-Object { $_.StartsWith("afyx-engineering-kit/$forbidden", [StringComparison]::OrdinalIgnoreCase) }) {
|
|
104
|
+
throw "Development fixture leaked into release ZIP: $forbidden"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
$reader = [IO.StreamReader]::new($zip.GetEntry($required[0]).Open())
|
|
108
|
+
try { if ($reader.ReadToEnd().Trim() -cne $Revision) { throw 'Packed revision marker mismatch' } }
|
|
109
|
+
finally { $reader.Dispose() }
|
|
110
|
+
} finally { $zip.Dispose() }
|
|
111
|
+
|
|
112
|
+
[IO.Directory]::CreateDirectory([IO.Path]::GetFullPath($OutputDir)) | Out-Null
|
|
113
|
+
$destination = Join-Path ([IO.Path]::GetFullPath($OutputDir)) $name
|
|
114
|
+
$digest = (Get-FileHash -Algorithm SHA256 -LiteralPath $tempZip).Hash.ToLowerInvariant()
|
|
115
|
+
if (Test-Path -LiteralPath $destination) {
|
|
116
|
+
$existing = (Get-FileHash -Algorithm SHA256 -LiteralPath $destination).Hash.ToLowerInvariant()
|
|
117
|
+
if ($existing -ne $digest) { throw "Destination already exists with different bytes: $destination" }
|
|
118
|
+
} else { Move-Item -LiteralPath $tempZip -Destination $destination }
|
|
119
|
+
[pscustomobject]@{ Path = $destination; Version = $version; Revision = $Revision; Sha256 = $digest }
|
|
120
|
+
} finally {
|
|
121
|
+
if ($stageDir -and (Test-Path -LiteralPath $stageDir)) {
|
|
122
|
+
Remove-Item -LiteralPath $stageDir -Recurse -Force
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from 'node:child_process';
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
5
|
+
import { basename, join, resolve } from 'node:path';
|
|
6
|
+
import { buildGraphReleaseArtifacts } from './prepare-g6-package.mjs';
|
|
7
|
+
import { verifyGraphArchivePaths } from './verify-graph-archive.mjs';
|
|
8
|
+
|
|
9
|
+
const [mode, ...args] = process.argv.slice(2);
|
|
10
|
+
function arg(name) { const index = args.indexOf(name); return index < 0 ? '' : args[index + 1]; }
|
|
11
|
+
const root = resolve(arg('--root') || '.');
|
|
12
|
+
const revision = arg('--revision');
|
|
13
|
+
if (!/^[0-9a-f]{40}$/.test(revision)) throw new Error('Exact source commit SHA required');
|
|
14
|
+
if (mode === 'build') {
|
|
15
|
+
buildGraphReleaseArtifacts(root, revision);
|
|
16
|
+
process.stdout.write('Graph artifacts built from selected commit\n');
|
|
17
|
+
} else if (mode === 'verify') {
|
|
18
|
+
const release = resolve(arg('--release'));
|
|
19
|
+
const archiveName = 'afyx-graph-win32-x64.zip';
|
|
20
|
+
const archive = join(release, archiveName);
|
|
21
|
+
const manifest = JSON.parse(readFileSync(join(release, 'RELEASE-MANIFEST.json'), 'utf8'));
|
|
22
|
+
const graphVersion = JSON.parse(readFileSync(join(root, 'afyx-graph', 'engine', 'package.json'), 'utf8')).version;
|
|
23
|
+
if (manifest.schema !== 1 || manifest.product !== 'Afyx Graph' ||
|
|
24
|
+
manifest.source_revision !== revision || manifest.product_version !== graphVersion ||
|
|
25
|
+
!Array.isArray(manifest.artifacts)) throw new Error('Graph manifest source/product mismatch');
|
|
26
|
+
const matches = manifest.artifacts.filter((item) => item.file === archiveName);
|
|
27
|
+
if (matches.length !== 1 || matches[0].target !== 'win32-x64' || !/^[0-9a-f]{64}$/.test(matches[0].sha256)) {
|
|
28
|
+
throw new Error('Missing or invalid Windows x64 Graph manifest entry');
|
|
29
|
+
}
|
|
30
|
+
const lines = readFileSync(join(release, 'SHA256SUMS'), 'utf8').trim().split(/\r?\n/);
|
|
31
|
+
const sums = lines.map((line) => /^([0-9a-f]{64}) (afyx-graph-(?:win32|linux)-x64\.(?:zip|tar\.gz))$/.exec(line));
|
|
32
|
+
if (sums.some((match) => !match) || sums.filter((match) => match[2] === archiveName).length !== 1) {
|
|
33
|
+
throw new Error('Missing, duplicate, or malformed Windows Graph SHA256SUMS entry');
|
|
34
|
+
}
|
|
35
|
+
const bytes = readFileSync(archive);
|
|
36
|
+
const digest = createHash('sha256').update(bytes).digest('hex');
|
|
37
|
+
if (digest !== matches[0].sha256 || digest !== sums.find((match) => match[2] === archiveName)[1]) {
|
|
38
|
+
throw new Error('Graph archive checksum mismatch');
|
|
39
|
+
}
|
|
40
|
+
verifyGraphArchivePaths(bytes, archiveName);
|
|
41
|
+
const names = execFileSync('tar', ['-tf', archive], { encoding: 'utf8' }).trim().split(/\r?\n/);
|
|
42
|
+
const prefix = basename(archive, '.zip');
|
|
43
|
+
for (const required of [`${prefix}/metadata.json`, `${prefix}/bin/afyx-graph.cmd`,
|
|
44
|
+
`${prefix}/lib/dist/bin/afyx-graph.js`, `${prefix}/lib/dist/viewer/index.html`]) {
|
|
45
|
+
if (!names.includes(required)) throw new Error(`Incomplete Graph archive: ${required}`);
|
|
46
|
+
}
|
|
47
|
+
const metadata = JSON.parse(execFileSync('tar', ['-xOf', archive, `${prefix}/metadata.json`], { encoding: 'utf8' }));
|
|
48
|
+
if (metadata.artifact_target !== 'win32-x64' || metadata.source_revision !== revision ||
|
|
49
|
+
metadata.build_identity !== `git:${revision}` || metadata.product_version !== graphVersion) {
|
|
50
|
+
throw new Error('Embedded Graph metadata source/target mismatch');
|
|
51
|
+
}
|
|
52
|
+
process.stdout.write(JSON.stringify({ revision, digest, target: metadata.artifact_target, entries: names.length }) + '\n');
|
|
53
|
+
} else {
|
|
54
|
+
throw new Error('Usage: validate-release-zip-graph.mjs build|verify --root PATH --revision SHA [--release PATH]');
|
|
55
|
+
}
|
package/verify.ps1
CHANGED
|
@@ -11,8 +11,11 @@ param(
|
|
|
11
11
|
[string]$ClaudeConfigDir = $(if ($env:CLAUDE_CONFIG_DIR) { $env:CLAUDE_CONFIG_DIR } else { '' }),
|
|
12
12
|
[string]$ContextRuntimeRoot = $(if ($env:AFYX_CONTEXT_RUNTIME_ROOT) { $env:AFYX_CONTEXT_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\context' }),
|
|
13
13
|
[string]$ForgeRuntimeRoot = $(if ($env:AFYX_FORGE_RUNTIME_ROOT) { $env:AFYX_FORGE_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\forge' }),
|
|
14
|
+
[string]$GraphRuntimeRoot = $(if ($env:AFYX_GRAPH_RUNTIME_ROOT) { $env:AFYX_GRAPH_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\graph' }),
|
|
14
15
|
[string]$AfyxInstallRoot = $(if ($env:AFYX_INSTALL_ROOT) { $env:AFYX_INSTALL_ROOT } else { Join-Path $env:USERPROFILE '.afyx' }),
|
|
15
|
-
[string]$HostBridgeRuntimeRoot = $(if ($env:AFYX_HOST_BRIDGE_RUNTIME_ROOT) { $env:AFYX_HOST_BRIDGE_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\host-bridge' })
|
|
16
|
+
[string]$HostBridgeRuntimeRoot = $(if ($env:AFYX_HOST_BRIDGE_RUNTIME_ROOT) { $env:AFYX_HOST_BRIDGE_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\host-bridge' }),
|
|
17
|
+
[switch]$SkipProviderConfiguration,
|
|
18
|
+
[switch]$ReportJson
|
|
16
19
|
)
|
|
17
20
|
|
|
18
21
|
Set-StrictMode -Version Latest
|
|
@@ -21,11 +24,14 @@ $coreFailure = $false
|
|
|
21
24
|
$configuredProviders = @()
|
|
22
25
|
$codexHome = if ($env:CODEX_HOME) { $env:CODEX_HOME } else { Join-Path $env:USERPROFILE '.codex' }
|
|
23
26
|
$configPath = Join-Path $codexHome 'config.toml'
|
|
24
|
-
$graphRoot = if ($env:AFYX_GRAPH_RUNTIME_ROOT) { $env:AFYX_GRAPH_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\graph' }
|
|
27
|
+
$graphRoot = if ($GraphRuntimeRoot) { $GraphRuntimeRoot } elseif ($env:AFYX_GRAPH_RUNTIME_ROOT) { $env:AFYX_GRAPH_RUNTIME_ROOT } else { Join-Path $env:USERPROFILE '.afyx\graph' }
|
|
25
28
|
Import-Module (Join-Path $PSScriptRoot 'scripts\lib\AfyxTerminal.psm1') -Force
|
|
29
|
+
Import-Module (Join-Path $PSScriptRoot 'scripts\lib\AfyxPlatform.psm1') -Force
|
|
26
30
|
$terminal = New-AfyxTerminalContext
|
|
27
31
|
|
|
32
|
+
$verificationRows = [Collections.Generic.List[object]]::new()
|
|
28
33
|
function Write-Result([string]$State, [string]$Name, [string]$Detail = '') {
|
|
34
|
+
$verificationRows.Add([ordered]@{ state = $State; name = $Name; detail = $Detail })
|
|
29
35
|
$status = switch ($State) {
|
|
30
36
|
'OK' { 'HEALTHY' }
|
|
31
37
|
'FAIL' { 'BLOCKED' }
|
|
@@ -96,7 +102,7 @@ if ($gitSource -and (Test-Path -LiteralPath (Join-Path $PSScriptRoot '.git'))) {
|
|
|
96
102
|
foreach ($providerRecord in (Get-AfyxProviderRegistry)) {
|
|
97
103
|
Write-Result 'INFO' "Provider adapter: $($providerRecord.name)" "primary=$($providerRecord.primary); ownership=$($providerRecord.ownership_class); capabilities=$($providerRecord.capabilities); policy=$($providerRecord.configuration_policy)"
|
|
98
104
|
}
|
|
99
|
-
if ($Provider.Count) {
|
|
105
|
+
if ($Provider.Count -and -not $SkipProviderConfiguration) {
|
|
100
106
|
$nodeCommand = Get-Command node -ErrorAction SilentlyContinue
|
|
101
107
|
$entry = Join-Path $graphRoot 'current\lib\dist\bin\afyx-graph.js'
|
|
102
108
|
if ($nodeCommand -and (Test-Path -LiteralPath $entry -PathType Leaf)) {
|
|
@@ -169,7 +175,7 @@ if ($controlPlan -and $Provider.Count) {
|
|
|
169
175
|
$git = Get-Command git -ErrorAction SilentlyContinue
|
|
170
176
|
$node = Get-Command node -ErrorAction SilentlyContinue
|
|
171
177
|
$npm = Get-Command npm -ErrorAction SilentlyContinue
|
|
172
|
-
Write-Result 'OK' 'OS/architecture [REQUIRED]'
|
|
178
|
+
Write-Result 'OK' 'OS/architecture [REQUIRED]' (Get-AfyxPlatformDescription)
|
|
173
179
|
Write-Result 'OK' 'Platform shell [REQUIRED]' "PowerShell $($PSVersionTable.PSVersion)"
|
|
174
180
|
if ($git) { Write-Result 'OK' 'Git [REQUIRED]' ((& git --version 2>$null) -join ' ') } else { Write-Result 'FAIL' 'Git [REQUIRED]' 'missing; install Git for Windows from https://git-scm.com/'; $coreFailure = $true }
|
|
175
181
|
if ($node) {
|
|
@@ -182,9 +188,9 @@ if ($node) { Write-Result 'OK' 'Node.js [COMPONENT_REQUIRED:Afyx Context]' ((& n
|
|
|
182
188
|
else { Write-Result 'INFO' 'Node.js [COMPONENT_REQUIRED:Afyx Context]' 'missing; required only when Afyx Context is selected' }
|
|
183
189
|
if ($npm) { Write-Result 'OK' 'npm [BUILD_ONLY:Afyx Graph]' ((& npm --version 2>$null) -join ' ') } else { Write-Result 'INFO' 'npm [BUILD_ONLY:Afyx Graph]' 'missing; required only for local artifact fallback' }
|
|
184
190
|
Write-Result 'OK' 'Archive/checksum [COMPONENT_REQUIRED:Afyx Graph]' 'Expand-Archive and Get-FileHash available'
|
|
185
|
-
$codexRequired = 'codex' -in $Provider -or -not $Provider.Count
|
|
186
|
-
$antigravityRequired = 'antigravity' -in $Provider
|
|
187
|
-
$claudeRequired = 'claude' -in $Provider
|
|
191
|
+
$codexRequired = -not $SkipProviderConfiguration -and ('codex' -in $Provider -or -not $Provider.Count)
|
|
192
|
+
$antigravityRequired = -not $SkipProviderConfiguration -and 'antigravity' -in $Provider
|
|
193
|
+
$claudeRequired = -not $SkipProviderConfiguration -and 'claude' -in $Provider
|
|
188
194
|
|
|
189
195
|
$codexHost = Get-AfyxCodexHost
|
|
190
196
|
$codex = if ($codexHost.State -eq 'CLI_READY') { [pscustomobject]@{ Source = $codexHost.Path } } else { $null }
|
|
@@ -371,7 +377,7 @@ if (-not $usagePresent) {
|
|
|
371
377
|
Write-Result 'INFO' 'Codex Usage Hook trust' 'verify with /hooks'
|
|
372
378
|
}
|
|
373
379
|
|
|
374
|
-
if ($Provider.Count -and $node) {
|
|
380
|
+
if ($Provider.Count -and $node -and -not $SkipProviderConfiguration) {
|
|
375
381
|
$workflowProviders = @($Provider | Where-Object { $_ -eq 'antigravity' -or ($_ -eq 'claude' -and $ProviderScope -eq 'workspace') })
|
|
376
382
|
$bridgeLifecycle = Join-Path $PSScriptRoot 'scripts\afyx-host-bridge-lifecycle.mjs'
|
|
377
383
|
$bridgeJson = (& $node.Source $bridgeLifecycle '--runtime-root' $HostBridgeRuntimeRoot 2>$null) -join ''
|
|
@@ -407,5 +413,15 @@ if ($Provider.Count -and $node) {
|
|
|
407
413
|
}
|
|
408
414
|
}
|
|
409
415
|
|
|
410
|
-
|
|
416
|
+
function Write-VerificationContract {
|
|
417
|
+
if (-not $ReportJson) { return }
|
|
418
|
+
$previousOutputEncoding = $OutputEncoding
|
|
419
|
+
try {
|
|
420
|
+
$OutputEncoding = [Text.UTF8Encoding]::new($false)
|
|
421
|
+
ConvertTo-Json -InputObject @($verificationRows.ToArray()) -Depth 5 -Compress | & node (Join-Path $PSScriptRoot 'scripts\afyx-install-contract.mjs') verification
|
|
422
|
+
if ($LASTEXITCODE -ne 0) { throw 'Unable to serialize backend verification results.' }
|
|
423
|
+
} finally { $OutputEncoding = $previousOutputEncoding }
|
|
424
|
+
}
|
|
425
|
+
if ($coreFailure) { Write-Result 'FAIL' 'Core readiness'; Write-VerificationContract; exit 1 }
|
|
411
426
|
Write-Result 'OK' 'Core readiness' 'ready; optional enhancement warnings do not affect this result'
|
|
427
|
+
Write-VerificationContract
|
package/verify.sh
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
|
+
report_json=false
|
|
4
|
+
verification_rows=()
|
|
3
5
|
|
|
4
6
|
PACKAGE_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
7
|
|
|
@@ -29,6 +31,7 @@ while (($#)); do
|
|
|
29
31
|
--skills-root) skills_root="$2"; skills_root_explicit=true; shift 2 ;;
|
|
30
32
|
--context-runtime-root) context_root="$2"; shift 2 ;;
|
|
31
33
|
--forge-runtime-root) forge_root="$2"; shift 2 ;;
|
|
34
|
+
--report-json) report_json=true; shift ;;
|
|
32
35
|
--preset) preset="$2"; shift 2 ;;
|
|
33
36
|
--custom-component) custom_component_list="${custom_component_list:+$custom_component_list;}$2"; shift 2 ;;
|
|
34
37
|
--provider) provider_list="$2"; provider_explicit=true; shift 2 ;;
|
|
@@ -64,6 +67,7 @@ fi
|
|
|
64
67
|
|
|
65
68
|
result() {
|
|
66
69
|
local state="$1" label="$2" detail="${3:-}"
|
|
70
|
+
verification_rows+=("$state" "$label" "$detail")
|
|
67
71
|
[[ -n "$detail" ]] && printf '[%s] %s — %s\n' "$state" "$label" "$detail" || printf '[%s] %s\n' "$state" "$label"
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -261,5 +265,9 @@ if ! "$codex_detected"; then result SKIP 'Codex config' 'PROVIDER_NOT_INSTALLED'
|
|
|
261
265
|
elif [[ -f "$config" ]]; then result OK 'Codex config' 'read-only check completed'
|
|
262
266
|
else result WARN 'Codex config' 'not found; optional MCP entries unavailable'; fi
|
|
263
267
|
|
|
264
|
-
|
|
268
|
+
emit_verification_contract() {
|
|
269
|
+
if "$report_json"; then node "$PACKAGE_ROOT/scripts/afyx-install-contract.mjs" verification-rows "${verification_rows[@]}"; fi
|
|
270
|
+
}
|
|
271
|
+
if "$core_failure"; then result FAIL 'Core readiness'; emit_verification_contract; exit 1; fi
|
|
265
272
|
result OK 'Core readiness' 'ready; optional enhancement warnings do not affect this result'
|
|
273
|
+
emit_verification_contract
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import { AfyxContextEngine } from '../src/engine.js';
|
|
3
|
-
import { ContextStore } from '../src/storage.js';
|
|
4
|
-
|
|
5
|
-
const sleeper = new Int32Array(new SharedArrayBuffer(4));
|
|
6
|
-
const [mode, stateDir, ownerId, sessionId, readyPath, gatePath, outputPath, payload = '', id = 'worker', timeout = '5000'] = process.argv.slice(2);
|
|
7
|
-
|
|
8
|
-
function waitForGate() {
|
|
9
|
-
fs.writeFileSync(readyPath, `${process.pid}\n`, { flag: 'wx' });
|
|
10
|
-
const deadline = Date.now() + 15_000;
|
|
11
|
-
while (!fs.existsSync(gatePath)) {
|
|
12
|
-
if (Date.now() >= deadline) throw new Error('coordination fixture gate timed out');
|
|
13
|
-
Atomics.wait(sleeper, 0, 0, 10);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
try {
|
|
18
|
-
if (mode === 'hold') {
|
|
19
|
-
const store = new ContextStore({ stateDir, ownerId, sessionId, lockTimeoutMs: Number(timeout) });
|
|
20
|
-
store.withExclusiveAccess(() => {
|
|
21
|
-
waitForGate();
|
|
22
|
-
Atomics.wait(sleeper, 0, 0, 30_000);
|
|
23
|
-
});
|
|
24
|
-
} else if (mode === 'interrupt-write') {
|
|
25
|
-
const engine = new AfyxContextEngine({ stateDir, ownerId, sessionId, lockTimeoutMs: Number(timeout) });
|
|
26
|
-
const renameSync = fs.renameSync;
|
|
27
|
-
fs.renameSync = (source, destination) => {
|
|
28
|
-
if (destination === engine.store.sessionPath) {
|
|
29
|
-
fs.writeFileSync(readyPath, `${process.pid}\n`, { flag: 'wx' });
|
|
30
|
-
Atomics.wait(sleeper, 0, 0, 30_000);
|
|
31
|
-
}
|
|
32
|
-
return renameSync(source, destination);
|
|
33
|
-
};
|
|
34
|
-
engine.reduce({ segments: [{ id, content: payload }] });
|
|
35
|
-
} else if (mode === 'reduce') {
|
|
36
|
-
waitForGate();
|
|
37
|
-
const engine = new AfyxContextEngine({ stateDir, ownerId, sessionId, lockTimeoutMs: Number(timeout) });
|
|
38
|
-
const result = engine.reduce({ segments: [{ id, content: payload }] });
|
|
39
|
-
fs.writeFileSync(outputPath, JSON.stringify({ ok: true, result }), { flag: 'wx' });
|
|
40
|
-
} else {
|
|
41
|
-
throw new Error(`unknown coordination fixture mode: ${mode}`);
|
|
42
|
-
}
|
|
43
|
-
} catch (error) {
|
|
44
|
-
if (outputPath) {
|
|
45
|
-
fs.writeFileSync(outputPath, JSON.stringify({
|
|
46
|
-
ok: false,
|
|
47
|
-
code: error?.code ?? 'INTERNAL',
|
|
48
|
-
message: error?.message ?? String(error),
|
|
49
|
-
}), { flag: 'wx' });
|
|
50
|
-
}
|
|
51
|
-
process.exitCode = 2;
|
|
52
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from . import models
|
package/afyx-context/test-fixtures/graph-consumer-repo/addons/sale_extension/models/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from . import sale_order
|
package/afyx-context/test-fixtures/integrated-dogfood-repo/addons/integrated_sales/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from . import models
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
from odoo import api, fields, models
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class SaleOrder(models.Model):
|
|
5
|
-
_inherit = "sale.order"
|
|
6
|
-
|
|
7
|
-
afyx_review_note = fields.Char(copy=False)
|
|
8
|
-
afyx_total_snapshot = fields.Monetary(compute="_compute_afyx_total_snapshot")
|
|
9
|
-
|
|
10
|
-
@api.depends("order_line.price_subtotal")
|
|
11
|
-
def _compute_afyx_total_snapshot(self):
|
|
12
|
-
for order in self:
|
|
13
|
-
order.afyx_total_snapshot = sum(order.order_line.mapped("price_subtotal"))
|
|
14
|
-
|
|
15
|
-
def afyx_repeated_summary(self):
|
|
16
|
-
return "AFYX integrated sale summary " * 48
|
|
17
|
-
|
|
18
|
-
def SECURITY(self):
|
|
19
|
-
"""SECURITY ACCESS DENIED evidence must remain byte complete."""
|
|
20
|
-
return self.afyx_review_note
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
from odoo import fields, models
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class SaleOrderAudit(models.Model):
|
|
5
|
-
_inherit = "sale.order"
|
|
6
|
-
|
|
7
|
-
afyx_audit_marker = fields.Char(copy=False)
|
|
8
|
-
|
|
9
|
-
def afyx_diagnostic_boundary(self):
|
|
10
|
-
"""ERROR FAILURE TRACEBACK evidence must remain byte complete."""
|
|
11
|
-
return self.afyx_audit_marker
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<odoo>
|
|
3
|
-
<record id="view_order_form_afyx_integrated" model="ir.ui.view">
|
|
4
|
-
<field name="name">sale.order.form.afyx.integrated</field>
|
|
5
|
-
<field name="model">sale.order</field>
|
|
6
|
-
<field name="inherit_id" ref="sale.view_order_form"/>
|
|
7
|
-
<field name="arch" type="xml">
|
|
8
|
-
<xpath expr="//field[@name='partner_id']" position="after">
|
|
9
|
-
<field name="afyx_review_note"/>
|
|
10
|
-
<field name="afyx_total_snapshot" readonly="1"/>
|
|
11
|
-
</xpath>
|
|
12
|
-
</field>
|
|
13
|
-
</record>
|
|
14
|
-
</odoo>
|