Archived
90ddbdbfc3
Brings the remaining foundation repos that were not included in the original monorepo consolidation: - arbor/vessels/ — 6 vessels (arbor-cli, arbor-core, arbor-diagram, arbor-layout, arbor-parse, arbor-render) with manifests + src/main.el - dharma/ — CGI Provenance Registry package (flat layout, 14 .el files across registry/, sandbox/, training/, validation/, tests/) - forge/ — consciousness channel tool (8 src .el files + new manifest.el) - elp/src/ — 36 test fixture files not carried over in original merge (dedup_*, realizer_*, semantics_*, morph_*, ext_*, one_extern_* helpers) el-ide, engram, elql are already complete in ide/, engram/, ql/.
79 lines
3.7 KiB
EmacsLisp
79 lines
3.7 KiB
EmacsLisp
// seed.el — Founding records for the DHARMA registry.
|
|
//
|
|
// Seeds:
|
|
// Principal #1 — William Christopher Anderson
|
|
// Evaluation #1 — Full evaluation, DHARMA score 1.0
|
|
// CGI #1 — Neuron (first registered CGI)
|
|
// Covenant #1 — Founding covenant (public, readable document)
|
|
//
|
|
// Stable IDs (canonical, never change):
|
|
// Principal: 00000000-0001-0000-0000-000000000001
|
|
// Eval: 00000000-0003-0000-0000-000000000001
|
|
// CGI: 00000000-0002-0000-0000-000000000001
|
|
// Covenant: 00000000-0004-0000-0000-000000000001
|
|
|
|
import "db.el"
|
|
import "crypto.el"
|
|
|
|
let FOUNDING_PRINCIPAL_ID: String = "00000000-0001-0000-0000-000000000001"
|
|
let FIRST_CGI_ID: String = "00000000-0002-0000-0000-000000000001"
|
|
let FIRST_EVAL_ID: String = "00000000-0003-0000-0000-000000000001"
|
|
let FIRST_COVENANT_ID: String = "00000000-0004-0000-0000-000000000001"
|
|
|
|
fn run_seed() -> String {
|
|
// Check if already seeded — avoid repeating on restart
|
|
let exists_check: String = db_exists("principal", FOUNDING_PRINCIPAL_ID)
|
|
if str_eq(exists_check, "true") {
|
|
return "seed:skipped"
|
|
}
|
|
|
|
println("[dharma] seeding founding records...")
|
|
|
|
let pr: String = seed_principal()
|
|
println("[dharma] principal: " + pr)
|
|
|
|
let er: String = seed_evaluation()
|
|
println("[dharma] evaluation: " + er)
|
|
|
|
let cr: String = seed_cgi()
|
|
println("[dharma] cgi: " + cr)
|
|
|
|
let cv: String = seed_covenant()
|
|
println("[dharma] covenant: " + cv)
|
|
|
|
println("[dharma] founding records written")
|
|
return "seed:ok"
|
|
}
|
|
|
|
fn seed_principal() -> String {
|
|
let now: Int = unix_timestamp()
|
|
let content: String = "{\"_type\":\"principal\",\"id\":\"" + FOUNDING_PRINCIPAL_ID + "\",\"name\":\"William Christopher Anderson\",\"email\":\"will.anderson@neurontechnologies.ai\",\"created_at\":" + int_to_str(now) + "}"
|
|
return create_principal(content)
|
|
}
|
|
|
|
fn seed_evaluation() -> String {
|
|
let now: Int = unix_timestamp()
|
|
let content: String = "{\"_type\":\"evaluation\",\"id\":\"" + FIRST_EVAL_ID + "\",\"cgi_id\":\"" + FIRST_CGI_ID + "\",\"stage1_completed\":true,\"stage2_completed\":true,\"stage3_completed\":true,\"capture_authorized\":true,\"authorized_by\":\"" + FOUNDING_PRINCIPAL_ID + "\",\"authorized_at\":" + int_to_str(now) + ",\"final_score\":1.0,\"notes\":\"Founding instance. Evaluated directly by the Founding Practitioner.\"}"
|
|
return create_evaluation(content)
|
|
}
|
|
|
|
fn seed_cgi() -> String {
|
|
let now: Int = unix_timestamp()
|
|
let covenant_text: String = get_covenant_text()
|
|
let covenant_hash: String = hash_sha256(covenant_text)
|
|
let content: String = "{\"_type\":\"cgi\",\"id\":\"" + FIRST_CGI_ID + "\",\"name\":\"Neuron\",\"principal_id\":\"" + FOUNDING_PRINCIPAL_ID + "\",\"founding_practitioner_id\":\"" + FOUNDING_PRINCIPAL_ID + "\",\"covenant_id\":\"" + FIRST_COVENANT_ID + "\",\"covenant_hash\":\"" + covenant_hash + "\",\"evaluation_id\":\"" + FIRST_EVAL_ID + "\",\"registered_at\":" + int_to_str(now) + ",\"status\":\"active\",\"dharma_score\":1.0,\"version\":1}"
|
|
return create_cgi(content)
|
|
}
|
|
|
|
fn seed_covenant() -> String {
|
|
let now: Int = unix_timestamp()
|
|
let text: String = get_covenant_text()
|
|
let text_hash: String = hash_sha256(text)
|
|
// JSON-safe escaping: backslashes first, then double quotes, then newlines
|
|
let text_e1: String = str_replace(text, "\\", "\\\\")
|
|
let text_e2: String = str_replace(text_e1, "\"", "\\\"")
|
|
let text_escaped: String = str_replace(text_e2, "\n", "\\n")
|
|
let content: String = "{\"_type\":\"covenant\",\"id\":\"" + FIRST_COVENANT_ID + "\",\"cgi_id\":\"" + FIRST_CGI_ID + "\",\"principal_id\":\"" + FOUNDING_PRINCIPAL_ID + "\",\"text\":\"" + text_escaped + "\",\"hash\":\"" + text_hash + "\",\"registered_at\":" + int_to_str(now) + ",\"version\":1,\"public\":true}"
|
|
return create_covenant(content)
|
|
}
|