Skip to content

Commit 1c17ce6

Browse files
feat: migrate avow-lib (Idris2 + Zig FFI) from standards nested copy (#24)
## Summary - Migrates `avow-lib/` (Idris2 formal-verification tests, ABI source, Zig FFI) into this repo. It previously existed only inside `standards/avow-protocol/avow-lib`, orphaned from this repo's own history. - Part of a standards thin-binding pilot: `standards/avow-protocol` is being converted from a full duplicate into a thin pointer to this repo. This content needed a real home here first so it isn't discarded. - Migrated `.machine_readable/6a2` → `.machine_readable/descriptiles` per the estate naming mandate (2026-06-30). - Added missing SPDX headers (`CC-BY-SA-4.0` for new docs, `MPL-2.0` copyright line for `Main.idr`) to satisfy this repo's pre-commit license-header hook. ## Test plan - [ ] Confirm Idris2/Zig CI (if configured) picks up the new `avow-lib/` paths - [ ] Spot-check `avow-lib/README.adoc` renders correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 9a18e33 commit 1c17ce6

21 files changed

Lines changed: 3054 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
#
4+
# ECOSYSTEM.a2ml — Avow Lib ecosystem position
5+
[metadata]
6+
version = "1.0"
7+
last-updated = "2026-04-11"
8+
9+
[project]
10+
name = "Avow Lib"
11+
purpose = "TODO: Brief purpose statement"
12+
role = "TODO: library|application|tool|framework"
13+
14+
[position-in-ecosystem]
15+
category = ""
16+
17+
[related-projects]
18+
projects = [
19+
# No related projects recorded
20+
]
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
#
4+
# META.a2ml — Avow Lib meta-level information
5+
[metadata]
6+
version = "0.1.0"
7+
last-updated = "2026-04-11"
8+
9+
[project-info]
10+
license = "PMPL-1.0-or-later"
11+
author = "Jonathan D.A. Jewell (hyperpolymath)"
12+
13+
[architecture-decisions]
14+
decisions = [
15+
# No ADRs recorded
16+
]
17+
18+
[development-practices]
19+
versioning = "SemVer"
20+
documentation = "AsciiDoc"
21+
build-tool = "just"
22+
23+
[maintenance-axes]
24+
scoping-first = true
25+
axis-1 = "must > intend > like"
26+
axis-2 = "corrective > adaptive > perfective"
27+
axis-3 = "systems > compliance > effects"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
#
4+
# STATE.a2ml — Avow Lib project state
5+
[metadata]
6+
project = "libstamp"
7+
version = "1.0"
8+
last-updated = "2026-02-04"
9+
status = "active"
10+
session = "converted from scheme — 2026-04-11"
11+
12+
[project-context]
13+
name = "Libstamp"
14+
purpose = """TODO: Add project description"""
15+
completion-percentage = 0
16+
17+
[position]
18+
phase = "development" # design | implementation | testing | maintenance | archived
19+
maturity = "experimental" # experimental | alpha | beta | production | lts
20+
21+
[route-to-mvp]
22+
milestones = [
23+
# No milestones recorded
24+
]
25+
26+
[blockers-and-issues]
27+
issues = [
28+
# No blockers recorded
29+
]
30+
31+
[critical-next-actions]
32+
actions = [
33+
"Update STATE.scm with project details",
34+
]
35+
36+
[maintenance-status]
37+
last-run-utc = "2026-02-04T00:00:00Z"
38+
last-result = "unknown" # unknown | pass | warn | fail

avow-lib/BUILDING.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
<!--
2+
SPDX-License-Identifier: CC-BY-SA-4.0
3+
Copyright (c) Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
4+
-->
5+
# Building libstamp
6+
7+
## Current Status
8+
9+
**Core Idris2 types**: ✓ Complete (`src/abi/`)
10+
**Zig FFI implementation**: ✓ Complete (`ffi/zig/`)
11+
**Build system**: ⚠️ Zig version compatibility issue
12+
13+
## The Zig Version Issue
14+
15+
The FFI code is written for **Zig 0.13.0**, but your system has **Zig 0.15.2** installed.
16+
17+
Zig 0.15 is a development version with breaking API changes. The build system API is completely different.
18+
19+
## Option 1: Downgrade to Zig 0.13.0 (Recommended)
20+
21+
```bash
22+
# You have asdf installed, so:
23+
asdf install zig 0.13.0
24+
cd ~/Documents/hyperpolymath-repos/libstamp
25+
asdf local zig 0.13.0
26+
27+
# Now build works:
28+
cd ffi/zig
29+
zig build # Build library
30+
zig build test # Run tests
31+
zig build example # Run example
32+
```
33+
34+
## Option 2: Skip FFI for MVP
35+
36+
For the **Telegram bot demo** (your Week 1 goal), you don't actually need the full FFI yet.
37+
38+
**What you can do instead:**
39+
40+
1. **Mock the verification functions** in TypeScript/ReScript
41+
2. Build the Telegram bot with mocked verification
42+
3. Prove the UX works
43+
4. Come back and integrate real FFI later
44+
45+
This gets you to a working demo **faster**.
46+
47+
### Mock Implementation (TypeScript for Deno)
48+
49+
```typescript
50+
// mock-stamp.ts - Temporary until Zig FFI is built
51+
52+
export interface UnsubscribeParams {
53+
url: string;
54+
tested_at: number;
55+
response_code: number;
56+
response_time: number;
57+
token: string;
58+
signature: string;
59+
}
60+
61+
export function verifyUnsubscribe(params: UnsubscribeParams): boolean {
62+
// Mock implementation - checks basic properties
63+
if (!params.url.startsWith('https://')) return false;
64+
if (params.response_code !== 200) return false;
65+
if (params.response_time >= 200) return false;
66+
67+
const now = Date.now();
68+
const age = now - params.tested_at;
69+
if (age > 60000) return false; // > 60 seconds old
70+
71+
return true;
72+
}
73+
74+
export function generateProof(params: UnsubscribeParams): string {
75+
return JSON.stringify({
76+
type: "unsubscribe_verification",
77+
url: params.url,
78+
tested_at: params.tested_at,
79+
response_code: params.response_code,
80+
response_time_ms: params.response_time,
81+
verified: true,
82+
timestamp: Date.now(),
83+
}, null, 2);
84+
}
85+
```
86+
87+
This lets you:
88+
- ✓ Build Telegram bot **now**
89+
- ✓ Demo the UX **this week**
90+
- ✓ Show investors/users
91+
- → Add real FFI later (Week 2-3)
92+
93+
## Option 3: Update build.zig for Zig 0.15
94+
95+
If you want to use Zig 0.15, I can research the new API and update `build.zig`. But this will take time.
96+
97+
## My Recommendation
98+
99+
**For Week 1 (this week):**
100+
- Use **Option 2** (mock implementation)
101+
- Build Telegram bot with mocked verification
102+
- Get feedback from users
103+
104+
**For Week 2:**
105+
- Install Zig 0.13.0 (Option 1)
106+
- Build real FFI
107+
- Replace mocks with real verification
108+
109+
**Why:** Gets you to a demo **faster**. The UX is more important than the implementation for early feedback.
110+
111+
## Next Steps
112+
113+
Tell me which option you want:
114+
115+
1. **"Help me downgrade Zig"** → I'll guide you through asdf setup
116+
2. **"Let's use mocks for now"** → I'll help you build the Telegram bot immediately
117+
3. **"Fix build.zig for 0.15"** → I'll research and update (takes longer)
118+
119+
What's your priority?

avow-lib/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
POLYMATHEMATICAL META-PUBLIC LICENSE (PMPL)
2+
Version 1.0, or (at your option) any later version
3+
4+
Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
24+
---
25+
26+
This license is also known as the Palimpsest License.
27+
SPDX-License-Identifier: MPL-2.0

0 commit comments

Comments
 (0)