Skip to content

Commit f5187ef

Browse files
hyperpolymathclaude
andcommitted
v-ecosystem: accrue five V-tree arrivals for donation staging
Receives five V trees moved from other parts of the estate today as part of the V-lang → Zig migration + donation-staging policy. Hyperpolymath has Zig replacements in place; V sources come here neatly packaged for handover to the V community. - v-api-interfaces/v-bebop/ (from bebop-v-ffi/v/, renamed bebop-ffi today) - v-api-interfaces/v-proven/ (from verification-ecosystem/proven/bindings/v/) - v-api-interfaces/v-lol-i18n-lib/ (from standards/lol/api/v-lol/) - v-api-interfaces/v-lol-gateway/ (from standards/lol/api/v-gateway/) - v-api-interfaces/v-verisimdb-client/ (from verisimdb/connectors/clients/vlang/) Accompanied by 550a223 (TRANSFER.adoc + READMEs rewrite by donation- cleanup Sonnet). Handover-readiness tracked in v-ecosystem/TRANSFER.adoc; recreation-on-HP-side tracked in developer-ecosystem/RECREATION-QUEUE.adoc. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent afd51b4 commit f5187ef

32 files changed

Lines changed: 4336 additions & 0 deletions
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// SPDX-License-Identifier: AGPL-3.0-or-later
2+
// SPDX-FileCopyrightText: 2025 Hyperpolymath Contributors
3+
module bebop_bridge
4+
5+
// This module binds to the C ABI defined in include/bebop_v_ffi.h.
6+
// It intentionally uses ptr+len (VBytes) and does not assume NUL-terminated payload strings.
7+
8+
[typedef]
9+
pub struct C.BebopCtx {}
10+
11+
[typedef]
12+
pub struct C.VBytes {
13+
ptr &u8
14+
len usize
15+
}
16+
17+
[typedef]
18+
pub struct C.VSensorReading {
19+
timestamp u64
20+
sensor_id C.VBytes
21+
sensor_type u16
22+
value f64
23+
unit C.VBytes
24+
location C.VBytes
25+
metadata_count usize
26+
metadata_keys &C.VBytes
27+
metadata_values &C.VBytes
28+
error_code int
29+
error_message &char
30+
}
31+
32+
// C ABI functions
33+
fn C.bebop_ctx_new() &C.BebopCtx
34+
fn C.bebop_ctx_free(ctx &C.BebopCtx)
35+
fn C.bebop_ctx_reset(ctx &C.BebopCtx)
36+
37+
fn C.bebop_decode_sensor_reading(ctx &C.BebopCtx, data &u8, len usize, out &C.VSensorReading) int
38+
fn C.bebop_free_sensor_reading(ctx &C.BebopCtx, reading &C.VSensorReading)
39+
fn C.bebop_encode_batch_readings(ctx &C.BebopCtx, readings &C.VSensorReading, count usize, out_buf &u8, out_len usize) usize
40+
41+
// Helper: bytes -> V string (copies)
42+
[inline]
43+
fn bytes_to_string(b C.VBytes) string {
44+
if isnil(b.ptr) || b.len == 0 { return '' }
45+
return unsafe { b.ptr.vstring_with_len(int(b.len)) }
46+
}
47+
48+
// Small safe wrapper type
49+
pub struct BebopCtx {
50+
ctx &C.BebopCtx
51+
}
52+
53+
pub fn new_ctx() BebopCtx {
54+
return BebopCtx{ ctx: C.bebop_ctx_new() }
55+
}
56+
57+
pub fn (mut c BebopCtx) free() {
58+
if !isnil(c.ctx) {
59+
C.bebop_ctx_free(c.ctx)
60+
c.ctx = unsafe { nil }
61+
}
62+
}
63+
64+
pub fn (c &BebopCtx) reset() {
65+
if !isnil(c.ctx) { C.bebop_ctx_reset(c.ctx) }
66+
}
67+
68+
pub struct SensorReading {
69+
pub:
70+
timestamp u64
71+
sensor_id string
72+
sensor_type u16
73+
value f64
74+
unit string
75+
location string
76+
metadata map[string]string
77+
}
78+
79+
pub fn (c &BebopCtx) decode_sensor_reading(data []u8) ?SensorReading {
80+
mut out := C.VSensorReading{}
81+
rc := C.bebop_decode_sensor_reading(c.ctx, data.data, data.len, &out)
82+
if rc != 0 || out.error_code != 0 {
83+
return none
84+
}
85+
86+
mut md := map[string]string{}
87+
for i := 0; i < out.metadata_count; i++ {
88+
k := unsafe { out.metadata_keys[i] }
89+
v := unsafe { out.metadata_values[i] }
90+
md[bytes_to_string(k)] = bytes_to_string(v)
91+
}
92+
93+
// If the implementation needs explicit free per reading, call it here.
94+
// For pure arena allocation, ctx.reset() will reclaim.
95+
C.bebop_free_sensor_reading(c.ctx, &out)
96+
97+
return SensorReading{
98+
timestamp: out.timestamp
99+
sensor_id: bytes_to_string(out.sensor_id)
100+
sensor_type: out.sensor_type
101+
value: out.value
102+
unit: bytes_to_string(out.unit)
103+
location: bytes_to_string(out.location)
104+
metadata: md
105+
}
106+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// SPDX-License-Identifier: AGPL-3.0-or-later
2+
// SPDX-FileCopyrightText: 2025 Hyperpolymath Contributors
3+
module main
4+
5+
import net
6+
7+
fn write_u32_le(mut b []u8, v u32) {
8+
b[0] = u8(v & 0xff)
9+
b[1] = u8((v >> 8) & 0xff)
10+
b[2] = u8((v >> 16) & 0xff)
11+
b[3] = u8((v >> 24) & 0xff)
12+
}
13+
14+
fn main() {
15+
mut conn := net.dial_tcp('127.0.0.1:8080') or {
16+
eprintln('dial failed: $err')
17+
return
18+
}
19+
defer { conn.close() or {} }
20+
21+
// Replace with real Bebop-encoded payload bytes.
22+
payload := [u8(0x00), 0x01, 0x02]
23+
24+
mut hdr := []u8{len: 4}
25+
write_u32_le(mut hdr, u32(payload.len))
26+
27+
conn.write(hdr) or { return }
28+
conn.write(payload) or { return }
29+
println('sent ${payload.len} bytes')
30+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// SPDX-License-Identifier: AGPL-3.0-or-later
2+
// SPDX-FileCopyrightText: 2025 Hyperpolymath Contributors
3+
module main
4+
5+
import net
6+
import bebop_bridge
7+
8+
fn read_exact(mut conn net.TcpConn, mut buf []u8, n int) ? {
9+
mut got := 0
10+
for got < n {
11+
m := conn.read(mut buf[got..n]) or { return none }
12+
if m <= 0 { return none }
13+
got += m
14+
}
15+
}
16+
17+
fn read_u32_le(b []u8) u32 {
18+
return u32(b[0]) | (u32(b[1]) << 8) | (u32(b[2]) << 16) | (u32(b[3]) << 24)
19+
}
20+
21+
fn main() {
22+
mut listener := net.listen_tcp(.ip, ':8080') or {
23+
eprintln('Failed to listen: $err')
24+
return
25+
}
26+
println('Listening on :8080')
27+
28+
for {
29+
mut conn := listener.accept() or { continue }
30+
go handle(mut conn)
31+
}
32+
}
33+
34+
fn handle(mut conn net.TcpConn) {
35+
defer { conn.close() or {} }
36+
37+
mut ctx := bebop_bridge.new_ctx()
38+
defer { ctx.free() }
39+
40+
mut hdr := []u8{len: 4}
41+
for {
42+
read_exact(mut conn, mut hdr, 4) or { break }
43+
msg_len := int(read_u32_le(hdr))
44+
if msg_len <= 0 || msg_len > 1_000_000 {
45+
eprintln('Bad length: $msg_len')
46+
break
47+
}
48+
mut payload := []u8{len: msg_len}
49+
read_exact(mut conn, mut payload, msg_len) or { break }
50+
51+
reading := ctx.decode_sensor_reading(payload) or {
52+
eprintln('Decode failed')
53+
ctx.reset()
54+
continue
55+
}
56+
57+
println('sensor_id=${reading.sensor_id} value=${reading.value} unit=${reading.unit}')
58+
ctx.reset()
59+
}
60+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Module {
2+
name: bebop_bridge
3+
version: 0.0.1
4+
description: FFI bindings for Bebop binary serialization
5+
license: AGPL-3.0-or-later
6+
repo: https://github.com/hyperpolymath/bebop-v-ffi
7+
dependencies: []
8+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// SPDX-License-Identifier: PMPL-1.0-or-later
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
= LOL v-gateway — V-lang Deprecated (2026-04-12)
4+
:toc:
5+
6+
== Status
7+
8+
The V-lang implementation in `src/` is *deprecated* as of 2026-04-12
9+
following the estate-wide V-lang ban (2026-04-10).
10+
11+
== Migration Target: Zig
12+
13+
The canonical replacement is the Zig gateway at `../zig-gateway/`:
14+
15+
[source,bash]
16+
----
17+
# From standards/lol/api/zig-gateway/
18+
zig build
19+
./zig-out/bin/lol-gateway
20+
----
21+
22+
The Zig gateway is a three-port listener matching the V layout:
23+
24+
[cols="1,1,1"]
25+
|===
26+
| Mount | Port | V source
27+
28+
| REST | `LOL_PORT` (default 7800) | `src/main.v` (REST routes)
29+
| gRPC | `LOL_PORT+1` (default 7801) | `src/main.v` (gRPC listener)
30+
| GraphQL | `LOL_PORT+2` (default 7802) | `src/main.v` (GraphQL listener)
31+
|===
32+
33+
== Next Steps
34+
35+
. Confirm `zig-gateway` handles `/api/v1/languages`, `/api/v1/corpus`,
36+
`/api/v1/crawl`, and `/api/v1/health`.
37+
. Update `compose.yml` (if any) to replace the V container.
38+
. Once confirmed healthy, delete `src/*.v` and `v.mod`.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// SPDX-License-Identifier: PMPL-1.0-or-later
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
= LOL V-Gateway — V-lang Implementation SIDELINED
4+
:toc:
5+
6+
== Status
7+
8+
The V-lang LOL triple API gateway (`src/`) is *sidelined*
9+
as of 2026-04-12 following the estate-wide V-lang ban (2026-04-10).
10+
11+
== Migration Target
12+
13+
[cols="1,1"]
14+
|===
15+
| V module (sidelined) | Replacement
16+
17+
| `rest.v` | Axum (Rust) REST handler
18+
| `grpc.v` | tonic (Rust) gRPC service
19+
| `graphql.v` | async-graphql (Rust) schema
20+
| `domain.v` | Rust domain types
21+
| `helpers.v` | Rust utilities
22+
| `main.v` | Rust Tokio entrypoint
23+
|===
24+
25+
The v-lol gateway (`../v-lol/`) is also sidelined — see `../v-lol/src/SIDELINED.adoc`.
26+
27+
The V-lang source is retained for reference but MUST NOT be compiled or deployed.

0 commit comments

Comments
 (0)