@neuroverseos/governance 0.8.1 → 0.10.0
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/AGENTS.md +8 -0
- package/README.md +120 -2
- package/dist/{chunk-ETDIEVAX.js → chunk-BZYQHJDM.js} +800 -54
- package/dist/{chunk-F2LWMOM5.js → chunk-TCGGED4G.js} +14 -14
- package/dist/cli/neuroverse.cjs +1362 -219
- package/dist/cli/radiant.cjs +1212 -116
- package/dist/cli/radiant.d.cts +44 -1
- package/dist/cli/radiant.d.ts +44 -1
- package/dist/cli/radiant.js +354 -28
- package/dist/cli/worldmodel.cjs +1055 -1000
- package/dist/cli/worldmodel.js +40 -0
- package/dist/{lenses-YDMKSXDL.js → lenses-XDWK6ZKI.js} +1 -1
- package/dist/radiant/index.cjs +826 -62
- package/dist/radiant/index.d.cts +304 -19
- package/dist/radiant/index.d.ts +304 -19
- package/dist/radiant/index.js +30 -2
- package/dist/{server-ZSQ6DRSN.js → server-EI5JCIBU.js} +2 -2
- package/examples/radiant-weekly-workflow.yml +84 -0
- package/package.json +2 -1
package/dist/cli/neuroverse.cjs
CHANGED
|
@@ -2002,10 +2002,10 @@ __export(world_loader_exports, {
|
|
|
2002
2002
|
});
|
|
2003
2003
|
async function loadWorldFromDirectory(dirPath) {
|
|
2004
2004
|
const { readFile: readFile4 } = await import("fs/promises");
|
|
2005
|
-
const { join:
|
|
2005
|
+
const { join: join21 } = await import("path");
|
|
2006
2006
|
const { readdirSync: readdirSync11 } = await import("fs");
|
|
2007
2007
|
async function readJson(filename) {
|
|
2008
|
-
const filePath =
|
|
2008
|
+
const filePath = join21(dirPath, filename);
|
|
2009
2009
|
try {
|
|
2010
2010
|
const content = await readFile4(filePath, "utf-8");
|
|
2011
2011
|
return JSON.parse(content);
|
|
@@ -2035,11 +2035,11 @@ async function loadWorldFromDirectory(dirPath) {
|
|
|
2035
2035
|
const metadataJson = await readJson("metadata.json");
|
|
2036
2036
|
const rules = [];
|
|
2037
2037
|
try {
|
|
2038
|
-
const rulesDir =
|
|
2038
|
+
const rulesDir = join21(dirPath, "rules");
|
|
2039
2039
|
const ruleFiles = readdirSync11(rulesDir).filter((f) => f.endsWith(".json")).sort();
|
|
2040
2040
|
for (const file of ruleFiles) {
|
|
2041
2041
|
try {
|
|
2042
|
-
const content = await readFile4(
|
|
2042
|
+
const content = await readFile4(join21(rulesDir, file), "utf-8");
|
|
2043
2043
|
rules.push(JSON.parse(content));
|
|
2044
2044
|
} catch (err) {
|
|
2045
2045
|
process.stderr.write(
|
|
@@ -2093,8 +2093,8 @@ async function loadWorld(worldPath) {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
async function loadBundledWorld(name = DEFAULT_BUNDLED_WORLD) {
|
|
2095
2095
|
const { readFile: readFile4 } = await import("fs/promises");
|
|
2096
|
-
const { join:
|
|
2097
|
-
const { existsSync:
|
|
2096
|
+
const { join: join21, dirname: dirname4 } = await import("path");
|
|
2097
|
+
const { existsSync: existsSync17 } = await import("fs");
|
|
2098
2098
|
const { fileURLToPath: fileURLToPath3 } = await import("url");
|
|
2099
2099
|
const { parseWorldMarkdown: parseWorldMarkdown2 } = await Promise.resolve().then(() => (init_bootstrap_parser(), bootstrap_parser_exports));
|
|
2100
2100
|
const { emitWorldDefinition: emitWorldDefinition2 } = await Promise.resolve().then(() => (init_bootstrap_emitter(), bootstrap_emitter_exports));
|
|
@@ -2102,16 +2102,16 @@ async function loadBundledWorld(name = DEFAULT_BUNDLED_WORLD) {
|
|
|
2102
2102
|
let packageRoot;
|
|
2103
2103
|
try {
|
|
2104
2104
|
const thisFile = typeof __dirname !== "undefined" ? __dirname : dirname4(fileURLToPath3(import_meta.url));
|
|
2105
|
-
packageRoot =
|
|
2105
|
+
packageRoot = join21(thisFile, "..", "..");
|
|
2106
2106
|
} catch {
|
|
2107
2107
|
packageRoot = process.cwd();
|
|
2108
2108
|
}
|
|
2109
2109
|
const candidates = [
|
|
2110
|
-
|
|
2111
|
-
|
|
2110
|
+
join21(packageRoot, "dist", "worlds", filename),
|
|
2111
|
+
join21(packageRoot, "src", "worlds", filename)
|
|
2112
2112
|
];
|
|
2113
2113
|
for (const candidate of candidates) {
|
|
2114
|
-
if (
|
|
2114
|
+
if (existsSync17(candidate)) {
|
|
2115
2115
|
const markdown = await readFile4(candidate, "utf-8");
|
|
2116
2116
|
const parsed = parseWorldMarkdown2(markdown);
|
|
2117
2117
|
if (!parsed.world) {
|
|
@@ -2141,8 +2141,8 @@ function slugify(text) {
|
|
|
2141
2141
|
}
|
|
2142
2142
|
async function addGuard(worldDir, input) {
|
|
2143
2143
|
const { readFile: readFile4, writeFile: writeFile6 } = await import("fs/promises");
|
|
2144
|
-
const { join:
|
|
2145
|
-
const guardsPath =
|
|
2144
|
+
const { join: join21 } = await import("path");
|
|
2145
|
+
const guardsPath = join21(worldDir, "guards.json");
|
|
2146
2146
|
let config;
|
|
2147
2147
|
try {
|
|
2148
2148
|
const raw = await readFile4(guardsPath, "utf-8");
|
|
@@ -2182,9 +2182,9 @@ async function addGuard(worldDir, input) {
|
|
|
2182
2182
|
}
|
|
2183
2183
|
async function addRule(worldDir, input) {
|
|
2184
2184
|
const { readFile: readFile4, writeFile: writeFile6, mkdir: mkdir3 } = await import("fs/promises");
|
|
2185
|
-
const { join:
|
|
2185
|
+
const { join: join21 } = await import("path");
|
|
2186
2186
|
const { readdirSync: readdirSync11 } = await import("fs");
|
|
2187
|
-
const rulesDir =
|
|
2187
|
+
const rulesDir = join21(worldDir, "rules");
|
|
2188
2188
|
await mkdir3(rulesDir, { recursive: true });
|
|
2189
2189
|
let nextNum = 1;
|
|
2190
2190
|
try {
|
|
@@ -2214,7 +2214,7 @@ async function addRule(worldDir, input) {
|
|
|
2214
2214
|
effect_text: input.effects ? input.effects.map((e) => `${e.target} ${e.operation} ${e.value}`).join(", ") : "No direct effects"
|
|
2215
2215
|
}
|
|
2216
2216
|
};
|
|
2217
|
-
const rulePath =
|
|
2217
|
+
const rulePath = join21(rulesDir, `rule-${ruleNum}.json`);
|
|
2218
2218
|
await writeFile6(rulePath, JSON.stringify(rule, null, 2) + "\n");
|
|
2219
2219
|
const { loadWorldFromDirectory: loadWorldFromDirectory3 } = await Promise.resolve().then(() => (init_world_loader(), world_loader_exports));
|
|
2220
2220
|
const world = await loadWorldFromDirectory3(worldDir);
|
|
@@ -2230,8 +2230,8 @@ async function addRule(worldDir, input) {
|
|
|
2230
2230
|
}
|
|
2231
2231
|
async function addInvariant(worldDir, input) {
|
|
2232
2232
|
const { readFile: readFile4, writeFile: writeFile6 } = await import("fs/promises");
|
|
2233
|
-
const { join:
|
|
2234
|
-
const invariantsPath =
|
|
2233
|
+
const { join: join21 } = await import("path");
|
|
2234
|
+
const invariantsPath = join21(worldDir, "invariants.json");
|
|
2235
2235
|
let config;
|
|
2236
2236
|
try {
|
|
2237
2237
|
const raw = await readFile4(invariantsPath, "utf-8");
|
|
@@ -3528,21 +3528,21 @@ function parseArgs2(argv) {
|
|
|
3528
3528
|
}
|
|
3529
3529
|
async function writeWorldFiles(outputDir, world) {
|
|
3530
3530
|
const { writeFile: writeFile6, mkdir: mkdir3 } = await import("fs/promises");
|
|
3531
|
-
const { join:
|
|
3531
|
+
const { join: join21 } = await import("path");
|
|
3532
3532
|
await mkdir3(outputDir, { recursive: true });
|
|
3533
|
-
await writeFile6(
|
|
3534
|
-
await writeFile6(
|
|
3535
|
-
await writeFile6(
|
|
3536
|
-
await writeFile6(
|
|
3537
|
-
await writeFile6(
|
|
3538
|
-
await writeFile6(
|
|
3539
|
-
await writeFile6(
|
|
3540
|
-
const rulesDir =
|
|
3533
|
+
await writeFile6(join21(outputDir, "world.json"), JSON.stringify(world.world, null, 2));
|
|
3534
|
+
await writeFile6(join21(outputDir, "invariants.json"), JSON.stringify({ invariants: world.invariants }, null, 2));
|
|
3535
|
+
await writeFile6(join21(outputDir, "assumptions.json"), JSON.stringify(world.assumptions, null, 2));
|
|
3536
|
+
await writeFile6(join21(outputDir, "state-schema.json"), JSON.stringify(world.stateSchema, null, 2));
|
|
3537
|
+
await writeFile6(join21(outputDir, "gates.json"), JSON.stringify(world.gates, null, 2));
|
|
3538
|
+
await writeFile6(join21(outputDir, "outcomes.json"), JSON.stringify(world.outcomes, null, 2));
|
|
3539
|
+
await writeFile6(join21(outputDir, "metadata.json"), JSON.stringify(world.metadata, null, 2));
|
|
3540
|
+
const rulesDir = join21(outputDir, "rules");
|
|
3541
3541
|
await mkdir3(rulesDir, { recursive: true });
|
|
3542
3542
|
const sortedRules = [...world.rules].sort((a, b) => a.order - b.order);
|
|
3543
3543
|
for (let i = 0; i < sortedRules.length; i++) {
|
|
3544
3544
|
const ruleNum = String(i + 1).padStart(3, "0");
|
|
3545
|
-
await writeFile6(
|
|
3545
|
+
await writeFile6(join21(rulesDir, `rule-${ruleNum}.json`), JSON.stringify(sortedRules[i], null, 2));
|
|
3546
3546
|
}
|
|
3547
3547
|
}
|
|
3548
3548
|
function write(msg) {
|
|
@@ -3673,9 +3673,9 @@ World source written to: ${derivedPath}
|
|
|
3673
3673
|
try {
|
|
3674
3674
|
const emitResult = emitWorldDefinition(parseResult.world);
|
|
3675
3675
|
await writeWorldFiles(outputDir, emitResult.world);
|
|
3676
|
-
const { join:
|
|
3676
|
+
const { join: join21 } = await import("path");
|
|
3677
3677
|
const { copyFile } = await import("fs/promises");
|
|
3678
|
-
const sourceDest =
|
|
3678
|
+
const sourceDest = join21(outputDir, "source.nv-world.md");
|
|
3679
3679
|
if (derivedPath !== sourceDest) {
|
|
3680
3680
|
await copyFile(derivedPath, sourceDest);
|
|
3681
3681
|
}
|
|
@@ -5009,8 +5009,8 @@ async function main6(argv = process.argv.slice(2)) {
|
|
|
5009
5009
|
try {
|
|
5010
5010
|
const args = parseArgs6(argv);
|
|
5011
5011
|
const { writeFile: writeFile6 } = await import("fs/promises");
|
|
5012
|
-
const { existsSync:
|
|
5013
|
-
if (
|
|
5012
|
+
const { existsSync: existsSync17 } = await import("fs");
|
|
5013
|
+
if (existsSync17(args.outputPath)) {
|
|
5014
5014
|
process.stderr.write(`File already exists: ${args.outputPath}
|
|
5015
5015
|
`);
|
|
5016
5016
|
process.stderr.write("Use a different --output path or remove the existing file.\n");
|
|
@@ -5868,22 +5868,22 @@ function parseArgs9(argv) {
|
|
|
5868
5868
|
}
|
|
5869
5869
|
async function writeWorldFiles2(outputDir, world) {
|
|
5870
5870
|
const { writeFile: writeFile6, mkdir: mkdir3 } = await import("fs/promises");
|
|
5871
|
-
const { join:
|
|
5871
|
+
const { join: join21 } = await import("path");
|
|
5872
5872
|
await mkdir3(outputDir, { recursive: true });
|
|
5873
|
-
await writeFile6(
|
|
5874
|
-
await writeFile6(
|
|
5875
|
-
await writeFile6(
|
|
5876
|
-
await writeFile6(
|
|
5877
|
-
const rulesDir =
|
|
5873
|
+
await writeFile6(join21(outputDir, "world.json"), JSON.stringify(world.world, null, 2));
|
|
5874
|
+
await writeFile6(join21(outputDir, "invariants.json"), JSON.stringify({ invariants: world.invariants }, null, 2));
|
|
5875
|
+
await writeFile6(join21(outputDir, "assumptions.json"), JSON.stringify(world.assumptions, null, 2));
|
|
5876
|
+
await writeFile6(join21(outputDir, "state-schema.json"), JSON.stringify(world.stateSchema, null, 2));
|
|
5877
|
+
const rulesDir = join21(outputDir, "rules");
|
|
5878
5878
|
await mkdir3(rulesDir, { recursive: true });
|
|
5879
5879
|
const sortedRules = [...world.rules].sort((a, b) => a.order - b.order);
|
|
5880
5880
|
for (let i = 0; i < sortedRules.length; i++) {
|
|
5881
5881
|
const ruleNum = String(i + 1).padStart(3, "0");
|
|
5882
|
-
await writeFile6(
|
|
5882
|
+
await writeFile6(join21(rulesDir, `rule-${ruleNum}.json`), JSON.stringify(sortedRules[i], null, 2));
|
|
5883
5883
|
}
|
|
5884
|
-
await writeFile6(
|
|
5885
|
-
await writeFile6(
|
|
5886
|
-
await writeFile6(
|
|
5884
|
+
await writeFile6(join21(outputDir, "gates.json"), JSON.stringify(world.gates, null, 2));
|
|
5885
|
+
await writeFile6(join21(outputDir, "outcomes.json"), JSON.stringify(world.outcomes, null, 2));
|
|
5886
|
+
await writeFile6(join21(outputDir, "metadata.json"), JSON.stringify(world.metadata, null, 2));
|
|
5887
5887
|
}
|
|
5888
5888
|
async function main9(argv = process.argv.slice(2)) {
|
|
5889
5889
|
const startTime = performance.now();
|
|
@@ -8242,13 +8242,13 @@ function handleHealthCheck() {
|
|
|
8242
8242
|
}
|
|
8243
8243
|
async function handleListPresets(policiesDir) {
|
|
8244
8244
|
const { readdir, readFile: readFile4 } = await import("fs/promises");
|
|
8245
|
-
const { join:
|
|
8246
|
-
const dir = policiesDir ??
|
|
8245
|
+
const { join: join21 } = await import("path");
|
|
8246
|
+
const dir = policiesDir ?? join21(process.cwd(), "policies");
|
|
8247
8247
|
const presets = [];
|
|
8248
8248
|
try {
|
|
8249
8249
|
const files = await readdir(dir);
|
|
8250
8250
|
for (const file of files.filter((f) => f.endsWith(".txt")).sort()) {
|
|
8251
|
-
const content = await readFile4(
|
|
8251
|
+
const content = await readFile4(join21(dir, file), "utf-8");
|
|
8252
8252
|
const id = file.replace(".txt", "");
|
|
8253
8253
|
const name = id.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
8254
8254
|
const firstLine = content.split("\n").find((l) => l.trim().length > 0) ?? "";
|
|
@@ -8320,7 +8320,7 @@ function govern(action, world, options) {
|
|
|
8320
8320
|
}
|
|
8321
8321
|
async function writeTempWorld(dir, policyLines) {
|
|
8322
8322
|
const { writeFile: writeFile6, mkdir: mkdir3 } = await import("fs/promises");
|
|
8323
|
-
const { join:
|
|
8323
|
+
const { join: join21 } = await import("path");
|
|
8324
8324
|
await mkdir3(dir, { recursive: true });
|
|
8325
8325
|
const worldJson = {
|
|
8326
8326
|
world_id: "demo-live",
|
|
@@ -8362,9 +8362,9 @@ async function writeTempWorld(dir, policyLines) {
|
|
|
8362
8362
|
authoring_method: "manual-authoring"
|
|
8363
8363
|
};
|
|
8364
8364
|
await Promise.all([
|
|
8365
|
-
writeFile6(
|
|
8366
|
-
writeFile6(
|
|
8367
|
-
writeFile6(
|
|
8365
|
+
writeFile6(join21(dir, "world.json"), JSON.stringify(worldJson, null, 2)),
|
|
8366
|
+
writeFile6(join21(dir, "kernel.json"), JSON.stringify(kernelJson, null, 2)),
|
|
8367
|
+
writeFile6(join21(dir, "metadata.json"), JSON.stringify(metadataJson, null, 2))
|
|
8368
8368
|
]);
|
|
8369
8369
|
}
|
|
8370
8370
|
var init_govern = __esm({
|
|
@@ -8708,10 +8708,10 @@ data: ${data}
|
|
|
8708
8708
|
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
8709
8709
|
}
|
|
8710
8710
|
function readBody(req) {
|
|
8711
|
-
return new Promise((
|
|
8711
|
+
return new Promise((resolve14, reject) => {
|
|
8712
8712
|
const chunks = [];
|
|
8713
8713
|
req.on("data", (chunk) => chunks.push(chunk));
|
|
8714
|
-
req.on("end", () =>
|
|
8714
|
+
req.on("end", () => resolve14(Buffer.concat(chunks).toString("utf-8")));
|
|
8715
8715
|
req.on("error", reject);
|
|
8716
8716
|
});
|
|
8717
8717
|
}
|
|
@@ -11475,9 +11475,9 @@ async function main15(argv) {
|
|
|
11475
11475
|
}
|
|
11476
11476
|
if (worldPath) {
|
|
11477
11477
|
try {
|
|
11478
|
-
const { existsSync:
|
|
11479
|
-
const { join:
|
|
11480
|
-
const hasWorld =
|
|
11478
|
+
const { existsSync: existsSync17 } = await import("fs");
|
|
11479
|
+
const { join: join21 } = await import("path");
|
|
11480
|
+
const hasWorld = existsSync17(join21(worldPath, "world.json"));
|
|
11481
11481
|
checks.push({
|
|
11482
11482
|
label: "World file detected",
|
|
11483
11483
|
status: hasWorld ? "pass" : "fail",
|
|
@@ -11492,12 +11492,12 @@ async function main15(argv) {
|
|
|
11492
11492
|
});
|
|
11493
11493
|
}
|
|
11494
11494
|
} else {
|
|
11495
|
-
const { existsSync:
|
|
11496
|
-
const { join:
|
|
11495
|
+
const { existsSync: existsSync17 } = await import("fs");
|
|
11496
|
+
const { join: join21 } = await import("path");
|
|
11497
11497
|
const candidates = ["./world", "./.neuroverse", "./worlds"];
|
|
11498
11498
|
let found;
|
|
11499
11499
|
for (const dir of candidates) {
|
|
11500
|
-
if (
|
|
11500
|
+
if (existsSync17(join21(dir, "world.json"))) {
|
|
11501
11501
|
found = dir;
|
|
11502
11502
|
break;
|
|
11503
11503
|
}
|
|
@@ -12549,8 +12549,8 @@ async function deriveCommand(args) {
|
|
|
12549
12549
|
return;
|
|
12550
12550
|
}
|
|
12551
12551
|
const plan = result.plan;
|
|
12552
|
-
const { mkdirSync:
|
|
12553
|
-
|
|
12552
|
+
const { mkdirSync: mkdirSync8 } = await import("fs");
|
|
12553
|
+
mkdirSync8(outputDir, { recursive: true });
|
|
12554
12554
|
const worldJson = {
|
|
12555
12555
|
world_id: `plan_${plan.plan_id}`,
|
|
12556
12556
|
name: `Derived: ${plan.objective}`,
|
|
@@ -13148,7 +13148,7 @@ async function runPipeMode(config) {
|
|
|
13148
13148
|
`);
|
|
13149
13149
|
}
|
|
13150
13150
|
const MAX_BUFFER_SIZE = 1e6;
|
|
13151
|
-
return new Promise((
|
|
13151
|
+
return new Promise((resolve14, reject) => {
|
|
13152
13152
|
let buffer = "";
|
|
13153
13153
|
process.stdin.setEncoding("utf-8");
|
|
13154
13154
|
process.stdin.on("data", (chunk) => {
|
|
@@ -13194,7 +13194,7 @@ async function runPipeMode(config) {
|
|
|
13194
13194
|
`[neuroverse] Session complete: ${finalState.actionsEvaluated} evaluated, ${finalState.actionsAllowed} allowed, ${finalState.actionsBlocked} blocked, ${finalState.actionsPaused} paused
|
|
13195
13195
|
`
|
|
13196
13196
|
);
|
|
13197
|
-
|
|
13197
|
+
resolve14();
|
|
13198
13198
|
});
|
|
13199
13199
|
process.stdin.on("error", reject);
|
|
13200
13200
|
});
|
|
@@ -13310,8 +13310,8 @@ ${response.content}
|
|
|
13310
13310
|
rl2.on("close", () => {
|
|
13311
13311
|
session.stop();
|
|
13312
13312
|
});
|
|
13313
|
-
return new Promise((
|
|
13314
|
-
rl2.on("close",
|
|
13313
|
+
return new Promise((resolve14) => {
|
|
13314
|
+
rl2.on("close", resolve14);
|
|
13315
13315
|
});
|
|
13316
13316
|
}
|
|
13317
13317
|
var SessionManager;
|
|
@@ -14422,27 +14422,27 @@ function computeWorldDiff(a, b) {
|
|
|
14422
14422
|
}
|
|
14423
14423
|
async function worldSnapshot(worldPath) {
|
|
14424
14424
|
const { readdir, readFile: readFile4, mkdir: mkdir3, writeFile: writeFile6 } = await import("fs/promises");
|
|
14425
|
-
const { join:
|
|
14425
|
+
const { join: join21 } = await import("path");
|
|
14426
14426
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
14427
|
-
const snapshotDir =
|
|
14427
|
+
const snapshotDir = join21(worldPath, ".snapshots", timestamp);
|
|
14428
14428
|
await mkdir3(snapshotDir, { recursive: true });
|
|
14429
14429
|
const files = await readdir(worldPath);
|
|
14430
14430
|
let copied = 0;
|
|
14431
14431
|
for (const file of files) {
|
|
14432
14432
|
if (file.endsWith(".json")) {
|
|
14433
|
-
const content = await readFile4(
|
|
14434
|
-
await writeFile6(
|
|
14433
|
+
const content = await readFile4(join21(worldPath, file), "utf-8");
|
|
14434
|
+
await writeFile6(join21(snapshotDir, file), content, "utf-8");
|
|
14435
14435
|
copied++;
|
|
14436
14436
|
}
|
|
14437
14437
|
}
|
|
14438
14438
|
try {
|
|
14439
|
-
const rulesDir =
|
|
14439
|
+
const rulesDir = join21(worldPath, "rules");
|
|
14440
14440
|
const ruleFiles = await readdir(rulesDir);
|
|
14441
|
-
await mkdir3(
|
|
14441
|
+
await mkdir3(join21(snapshotDir, "rules"), { recursive: true });
|
|
14442
14442
|
for (const file of ruleFiles) {
|
|
14443
14443
|
if (file.endsWith(".json")) {
|
|
14444
|
-
const content = await readFile4(
|
|
14445
|
-
await writeFile6(
|
|
14444
|
+
const content = await readFile4(join21(rulesDir, file), "utf-8");
|
|
14445
|
+
await writeFile6(join21(snapshotDir, "rules", file), content, "utf-8");
|
|
14446
14446
|
copied++;
|
|
14447
14447
|
}
|
|
14448
14448
|
}
|
|
@@ -14455,8 +14455,8 @@ async function worldSnapshot(worldPath) {
|
|
|
14455
14455
|
}
|
|
14456
14456
|
async function worldRollback(worldPath) {
|
|
14457
14457
|
const { readdir, readFile: readFile4, writeFile: writeFile6, mkdir: mkdir3 } = await import("fs/promises");
|
|
14458
|
-
const { join:
|
|
14459
|
-
const snapshotsDir =
|
|
14458
|
+
const { join: join21 } = await import("path");
|
|
14459
|
+
const snapshotsDir = join21(worldPath, ".snapshots");
|
|
14460
14460
|
let snapshots;
|
|
14461
14461
|
try {
|
|
14462
14462
|
snapshots = (await readdir(snapshotsDir)).sort();
|
|
@@ -14471,34 +14471,34 @@ async function worldRollback(worldPath) {
|
|
|
14471
14471
|
return;
|
|
14472
14472
|
}
|
|
14473
14473
|
const latest = snapshots[snapshots.length - 1];
|
|
14474
|
-
const snapshotDir =
|
|
14474
|
+
const snapshotDir = join21(snapshotsDir, latest);
|
|
14475
14475
|
const backupTimestamp = "pre-rollback-" + (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
14476
|
-
const backupDir =
|
|
14476
|
+
const backupDir = join21(snapshotsDir, backupTimestamp);
|
|
14477
14477
|
await mkdir3(backupDir, { recursive: true });
|
|
14478
14478
|
const currentFiles = await readdir(worldPath);
|
|
14479
14479
|
for (const file of currentFiles) {
|
|
14480
14480
|
if (file.endsWith(".json")) {
|
|
14481
|
-
const content = await readFile4(
|
|
14482
|
-
await writeFile6(
|
|
14481
|
+
const content = await readFile4(join21(worldPath, file), "utf-8");
|
|
14482
|
+
await writeFile6(join21(backupDir, file), content, "utf-8");
|
|
14483
14483
|
}
|
|
14484
14484
|
}
|
|
14485
14485
|
const snapshotFiles = await readdir(snapshotDir);
|
|
14486
14486
|
let restored = 0;
|
|
14487
14487
|
for (const file of snapshotFiles) {
|
|
14488
14488
|
if (file.endsWith(".json")) {
|
|
14489
|
-
const content = await readFile4(
|
|
14490
|
-
await writeFile6(
|
|
14489
|
+
const content = await readFile4(join21(snapshotDir, file), "utf-8");
|
|
14490
|
+
await writeFile6(join21(worldPath, file), content, "utf-8");
|
|
14491
14491
|
restored++;
|
|
14492
14492
|
}
|
|
14493
14493
|
}
|
|
14494
14494
|
try {
|
|
14495
|
-
const rulesDir =
|
|
14495
|
+
const rulesDir = join21(snapshotDir, "rules");
|
|
14496
14496
|
const ruleFiles = await readdir(rulesDir);
|
|
14497
|
-
await mkdir3(
|
|
14497
|
+
await mkdir3(join21(worldPath, "rules"), { recursive: true });
|
|
14498
14498
|
for (const file of ruleFiles) {
|
|
14499
14499
|
if (file.endsWith(".json")) {
|
|
14500
|
-
const content = await readFile4(
|
|
14501
|
-
await writeFile6(
|
|
14500
|
+
const content = await readFile4(join21(rulesDir, file), "utf-8");
|
|
14501
|
+
await writeFile6(join21(worldPath, "rules", file), content, "utf-8");
|
|
14502
14502
|
restored++;
|
|
14503
14503
|
}
|
|
14504
14504
|
}
|
|
@@ -16400,27 +16400,27 @@ function closePrompts() {
|
|
|
16400
16400
|
}
|
|
16401
16401
|
function ask(question, defaultValue) {
|
|
16402
16402
|
const suffix = defaultValue ? ` [${defaultValue}]` : "";
|
|
16403
|
-
return new Promise((
|
|
16403
|
+
return new Promise((resolve14) => {
|
|
16404
16404
|
getRL().question(`
|
|
16405
16405
|
${question}${suffix}: `, (answer) => {
|
|
16406
16406
|
const val = answer.trim();
|
|
16407
|
-
|
|
16407
|
+
resolve14(val || defaultValue || "");
|
|
16408
16408
|
});
|
|
16409
16409
|
});
|
|
16410
16410
|
}
|
|
16411
16411
|
function confirm(question, defaultYes = true) {
|
|
16412
16412
|
const hint = defaultYes ? "[Y/n]" : "[y/N]";
|
|
16413
|
-
return new Promise((
|
|
16413
|
+
return new Promise((resolve14) => {
|
|
16414
16414
|
getRL().question(`
|
|
16415
16415
|
${question} ${hint}: `, (answer) => {
|
|
16416
16416
|
const val = answer.trim().toLowerCase();
|
|
16417
|
-
if (val === "")
|
|
16418
|
-
else
|
|
16417
|
+
if (val === "") resolve14(defaultYes);
|
|
16418
|
+
else resolve14(val === "y" || val === "yes");
|
|
16419
16419
|
});
|
|
16420
16420
|
});
|
|
16421
16421
|
}
|
|
16422
16422
|
function choose(question, options) {
|
|
16423
|
-
return new Promise((
|
|
16423
|
+
return new Promise((resolve14) => {
|
|
16424
16424
|
const r = getRL();
|
|
16425
16425
|
r.write(`
|
|
16426
16426
|
${question}
|
|
@@ -16430,9 +16430,9 @@ function choose(question, options) {
|
|
|
16430
16430
|
r.question(` Choice [1-${options.length}]: `, (answer) => {
|
|
16431
16431
|
const idx = parseInt(answer.trim(), 10) - 1;
|
|
16432
16432
|
if (idx >= 0 && idx < options.length) {
|
|
16433
|
-
|
|
16433
|
+
resolve14(options[idx]);
|
|
16434
16434
|
} else {
|
|
16435
|
-
|
|
16435
|
+
resolve14(options[0]);
|
|
16436
16436
|
}
|
|
16437
16437
|
});
|
|
16438
16438
|
});
|
|
@@ -16901,15 +16901,15 @@ function generateWorld(state) {
|
|
|
16901
16901
|
return { worldJson, stateSchema, guardsJson, rules, gatesJson, invariants, outcomes, metadata };
|
|
16902
16902
|
}
|
|
16903
16903
|
async function writeWorld(outputDir, world) {
|
|
16904
|
-
const { mkdirSync:
|
|
16904
|
+
const { mkdirSync: mkdirSync8, existsSync: existsSync17 } = await import("fs");
|
|
16905
16905
|
const { writeFile: writeFile6 } = await import("fs/promises");
|
|
16906
|
-
const { join:
|
|
16906
|
+
const { join: join21 } = await import("path");
|
|
16907
16907
|
const files = [];
|
|
16908
|
-
if (!
|
|
16909
|
-
const rulesDir =
|
|
16910
|
-
if (!
|
|
16908
|
+
if (!existsSync17(outputDir)) mkdirSync8(outputDir, { recursive: true });
|
|
16909
|
+
const rulesDir = join21(outputDir, "rules");
|
|
16910
|
+
if (!existsSync17(rulesDir)) mkdirSync8(rulesDir, { recursive: true });
|
|
16911
16911
|
const writeJson = async (name, data) => {
|
|
16912
|
-
const path =
|
|
16912
|
+
const path = join21(outputDir, name);
|
|
16913
16913
|
await writeFile6(path, JSON.stringify(data, null, 2) + "\n", "utf-8");
|
|
16914
16914
|
files.push(path);
|
|
16915
16915
|
};
|
|
@@ -16921,7 +16921,7 @@ async function writeWorld(outputDir, world) {
|
|
|
16921
16921
|
await writeJson("outcomes.json", world.outcomes);
|
|
16922
16922
|
await writeJson("metadata.json", world.metadata);
|
|
16923
16923
|
for (const rule of world.rules) {
|
|
16924
|
-
const rulePath =
|
|
16924
|
+
const rulePath = join21(rulesDir, `${rule.id}.json`);
|
|
16925
16925
|
await writeFile6(rulePath, JSON.stringify(rule, null, 2) + "\n", "utf-8");
|
|
16926
16926
|
files.push(rulePath);
|
|
16927
16927
|
}
|
|
@@ -17008,7 +17008,7 @@ async function main31(argv = process.argv.slice(2)) {
|
|
|
17008
17008
|
}
|
|
17009
17009
|
async function phaseRefine(outputDir, world) {
|
|
17010
17010
|
const { writeFile: writeFile6 } = await import("fs/promises");
|
|
17011
|
-
const { join:
|
|
17011
|
+
const { join: join21 } = await import("path");
|
|
17012
17012
|
heading("Refinement: Thresholds & Collapse");
|
|
17013
17013
|
const primaryMetric = world.gatesJson.viability_classification[0]?.field || "system_health";
|
|
17014
17014
|
info(`
|
|
@@ -17025,7 +17025,7 @@ async function phaseRefine(outputDir, world) {
|
|
|
17025
17025
|
if (!isNaN(parsed)) gate.value = parsed;
|
|
17026
17026
|
}
|
|
17027
17027
|
await writeFile6(
|
|
17028
|
-
|
|
17028
|
+
join21(outputDir, "gates.json"),
|
|
17029
17029
|
JSON.stringify(world.gatesJson, null, 2) + "\n",
|
|
17030
17030
|
"utf-8"
|
|
17031
17031
|
);
|
|
@@ -17047,7 +17047,7 @@ async function phaseRefine(outputDir, world) {
|
|
|
17047
17047
|
result: "MODEL_COLLAPSES"
|
|
17048
17048
|
};
|
|
17049
17049
|
await writeFile6(
|
|
17050
|
-
|
|
17050
|
+
join21(outputDir, "rules", `${rule.id}.json`),
|
|
17051
17051
|
JSON.stringify(rule, null, 2) + "\n",
|
|
17052
17052
|
"utf-8"
|
|
17053
17053
|
);
|
|
@@ -17155,7 +17155,7 @@ function previewLens(lens) {
|
|
|
17155
17155
|
const DIM4 = "\x1B[2m";
|
|
17156
17156
|
const CYAN3 = "\x1B[36m";
|
|
17157
17157
|
const YELLOW4 = "\x1B[33m";
|
|
17158
|
-
const
|
|
17158
|
+
const GREEN4 = "\x1B[32m";
|
|
17159
17159
|
const RESET4 = "\x1B[0m";
|
|
17160
17160
|
const lines = [];
|
|
17161
17161
|
lines.push("");
|
|
@@ -17166,7 +17166,7 @@ function previewLens(lens) {
|
|
|
17166
17166
|
if (d.example) {
|
|
17167
17167
|
lines.push(` ${BOLD4}${d.id}${RESET4}`);
|
|
17168
17168
|
lines.push(` ${YELLOW4}Without:${RESET4} ${DIM4}${d.example.without}${RESET4}`);
|
|
17169
|
-
lines.push(` ${
|
|
17169
|
+
lines.push(` ${GREEN4}With:${RESET4} ${d.example.with}`);
|
|
17170
17170
|
lines.push("");
|
|
17171
17171
|
}
|
|
17172
17172
|
}
|
|
@@ -18100,9 +18100,9 @@ async function cmdAdd(argv) {
|
|
|
18100
18100
|
id = name.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
|
|
18101
18101
|
}
|
|
18102
18102
|
const { readFile: readFile4, writeFile: writeFile6 } = await import("fs/promises");
|
|
18103
|
-
const { join:
|
|
18103
|
+
const { join: join21 } = await import("path");
|
|
18104
18104
|
const possiblePaths = [
|
|
18105
|
-
|
|
18105
|
+
join21(worldPath, "world.nv-world.md"),
|
|
18106
18106
|
worldPath
|
|
18107
18107
|
];
|
|
18108
18108
|
let mdPath = "";
|
|
@@ -18123,7 +18123,7 @@ async function cmdAdd(argv) {
|
|
|
18123
18123
|
const files = await readdir(worldPath);
|
|
18124
18124
|
const mdFile = files.find((f) => f.endsWith(".nv-world.md"));
|
|
18125
18125
|
if (mdFile) {
|
|
18126
|
-
mdPath =
|
|
18126
|
+
mdPath = join21(worldPath, mdFile);
|
|
18127
18127
|
mdContent = await readFile4(mdPath, "utf-8");
|
|
18128
18128
|
}
|
|
18129
18129
|
} catch {
|
|
@@ -18795,6 +18795,15 @@ var init_worldmodel_parser = __esm({
|
|
|
18795
18795
|
});
|
|
18796
18796
|
|
|
18797
18797
|
// src/engine/worldmodel-compiler.ts
|
|
18798
|
+
var worldmodel_compiler_exports = {};
|
|
18799
|
+
__export(worldmodel_compiler_exports, {
|
|
18800
|
+
compileWorldModel: () => compileWorldModel,
|
|
18801
|
+
emitContextsConfig: () => emitContextsConfig,
|
|
18802
|
+
emitLensSuggestions: () => emitLensSuggestions,
|
|
18803
|
+
emitOverlapMap: () => emitOverlapMap,
|
|
18804
|
+
emitSignalSchema: () => emitSignalSchema,
|
|
18805
|
+
emitWorldMarkdown: () => emitWorldMarkdown
|
|
18806
|
+
});
|
|
18798
18807
|
function toSnakeCase(text) {
|
|
18799
18808
|
return text.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
|
|
18800
18809
|
}
|
|
@@ -19151,14 +19160,14 @@ async function askQuestions() {
|
|
|
19151
19160
|
process.stderr.write(" There are no wrong answers \u2014 just say what you mean.\n");
|
|
19152
19161
|
process.stderr.write(" The AI will structure your answers into a worldmodel.\n\n");
|
|
19153
19162
|
for (const q of QUESTIONS) {
|
|
19154
|
-
const answer = await new Promise((
|
|
19163
|
+
const answer = await new Promise((resolve14) => {
|
|
19155
19164
|
process.stderr.write(` \x1B[1m${q.question}\x1B[0m
|
|
19156
19165
|
`);
|
|
19157
19166
|
process.stderr.write(` \x1B[2m${q.placeholder}\x1B[0m
|
|
19158
19167
|
`);
|
|
19159
19168
|
rl2.question(" > ", (ans) => {
|
|
19160
19169
|
process.stderr.write("\n");
|
|
19161
|
-
|
|
19170
|
+
resolve14(ans.trim());
|
|
19162
19171
|
});
|
|
19163
19172
|
});
|
|
19164
19173
|
answers[q.id] = answer;
|
|
@@ -19450,6 +19459,46 @@ ${YELLOW2}Validation found ${errors.length} issue${errors.length > 1 ? "s" : ""}
|
|
|
19450
19459
|
} else {
|
|
19451
19460
|
process.stderr.write(`${GREEN2}Validates cleanly!${RESET2}
|
|
19452
19461
|
`);
|
|
19462
|
+
try {
|
|
19463
|
+
if (!validateResult.model) throw new Error("no model");
|
|
19464
|
+
const { compileWorldModel: compileWorldModel2 } = await Promise.resolve().then(() => (init_worldmodel_compiler(), worldmodel_compiler_exports));
|
|
19465
|
+
const compiled = compileWorldModel2(validateResult.model);
|
|
19466
|
+
const outDir = (0, import_path13.dirname)(outputPath);
|
|
19467
|
+
const baseName = (0, import_path13.basename)(outputPath).replace(/\.worldmodel\.md$/, "");
|
|
19468
|
+
const worldPath = (0, import_path13.join)(outDir, `${baseName}.nv-world.md`);
|
|
19469
|
+
await (0, import_promises6.writeFile)(worldPath, compiled.worldMarkdown, "utf-8");
|
|
19470
|
+
const signalsPath = (0, import_path13.join)(outDir, "signals.json");
|
|
19471
|
+
await (0, import_promises6.writeFile)(signalsPath, JSON.stringify(compiled.signalSchema, null, 2), "utf-8");
|
|
19472
|
+
const overlapsPath = (0, import_path13.join)(outDir, "overlaps.json");
|
|
19473
|
+
await (0, import_promises6.writeFile)(overlapsPath, JSON.stringify(compiled.overlapMap, null, 2), "utf-8");
|
|
19474
|
+
const contextsPath = (0, import_path13.join)(outDir, "contexts.json");
|
|
19475
|
+
await (0, import_promises6.writeFile)(contextsPath, JSON.stringify(compiled.contextsConfig, null, 2), "utf-8");
|
|
19476
|
+
const lensesPath = (0, import_path13.join)(outDir, "lenses.json");
|
|
19477
|
+
await (0, import_promises6.writeFile)(lensesPath, JSON.stringify(compiled.lensSuggestions, null, 2), "utf-8");
|
|
19478
|
+
process.stderr.write(`
|
|
19479
|
+
${GREEN2}Compiled!${RESET2} Token-optimized artifacts:
|
|
19480
|
+
`);
|
|
19481
|
+
process.stderr.write(`${DIM2} ${worldPath}${RESET2}
|
|
19482
|
+
`);
|
|
19483
|
+
process.stderr.write(`${DIM2} ${signalsPath}${RESET2}
|
|
19484
|
+
`);
|
|
19485
|
+
process.stderr.write(`${DIM2} ${overlapsPath}${RESET2}
|
|
19486
|
+
`);
|
|
19487
|
+
process.stderr.write(`${DIM2} ${contextsPath}${RESET2}
|
|
19488
|
+
`);
|
|
19489
|
+
process.stderr.write(`${DIM2} ${lensesPath}${RESET2}
|
|
19490
|
+
`);
|
|
19491
|
+
process.stderr.write(`
|
|
19492
|
+
${DIM2}Source: ${outputPath} (readable, editable)${RESET2}
|
|
19493
|
+
`);
|
|
19494
|
+
process.stderr.write(`${DIM2}Compiled: ready for Radiant \u2014 token-optimized, no prose overhead.${RESET2}
|
|
19495
|
+
`);
|
|
19496
|
+
} catch {
|
|
19497
|
+
process.stderr.write(
|
|
19498
|
+
`${DIM2}Auto-compile skipped \u2014 run 'neuroverse worldmodel build ${(0, import_path13.basename)(outputPath)}' manually.${RESET2}
|
|
19499
|
+
`
|
|
19500
|
+
);
|
|
19501
|
+
}
|
|
19453
19502
|
}
|
|
19454
19503
|
} catch {
|
|
19455
19504
|
}
|
|
@@ -20590,7 +20639,7 @@ function sovereignConduitRewrite(pattern) {
|
|
|
20590
20639
|
return {
|
|
20591
20640
|
...pattern,
|
|
20592
20641
|
framing: "what this means for the people in the system",
|
|
20593
|
-
emphasis: "humanity +
|
|
20642
|
+
emphasis: "humanity + agency + learning",
|
|
20594
20643
|
compress: false
|
|
20595
20644
|
};
|
|
20596
20645
|
}
|
|
@@ -20601,17 +20650,17 @@ var init_sovereign_conduit = __esm({
|
|
|
20601
20650
|
SOVEREIGN_CONDUIT_FRAME = {
|
|
20602
20651
|
domains: [
|
|
20603
20652
|
"stewardship",
|
|
20604
|
-
"
|
|
20653
|
+
"agency",
|
|
20605
20654
|
"integration"
|
|
20606
20655
|
],
|
|
20607
20656
|
overlaps: [
|
|
20608
20657
|
{
|
|
20609
|
-
domains: ["stewardship", "
|
|
20658
|
+
domains: ["stewardship", "agency"],
|
|
20610
20659
|
emergent_state: "Trust",
|
|
20611
20660
|
description: "I am safe to be myself. When the system protects AND preserves individual authority, trust emerges \u2014 the feeling that you can think freely because someone is watching the boundaries."
|
|
20612
20661
|
},
|
|
20613
20662
|
{
|
|
20614
|
-
domains: ["
|
|
20663
|
+
domains: ["agency", "integration"],
|
|
20615
20664
|
emergent_state: "Possibility",
|
|
20616
20665
|
description: "My thinking can expand. When individual authority is preserved AND AI extends cognitive capability, possibility opens \u2014 the feeling that you can reach further without losing yourself."
|
|
20617
20666
|
},
|
|
@@ -20642,7 +20691,7 @@ var init_sovereign_conduit = __esm({
|
|
|
20642
20691
|
"harm detection",
|
|
20643
20692
|
"constraint design"
|
|
20644
20693
|
],
|
|
20645
|
-
"
|
|
20694
|
+
"agency": [
|
|
20646
20695
|
"independent thinking",
|
|
20647
20696
|
"decision ownership",
|
|
20648
20697
|
"self-trust",
|
|
@@ -20666,7 +20715,7 @@ var init_sovereign_conduit = __esm({
|
|
|
20666
20715
|
output_translation: {
|
|
20667
20716
|
never_surface_in_output: [
|
|
20668
20717
|
"Stewardship",
|
|
20669
|
-
"
|
|
20718
|
+
"Agency",
|
|
20670
20719
|
"Integration"
|
|
20671
20720
|
],
|
|
20672
20721
|
surface_freely: [
|
|
@@ -20681,7 +20730,7 @@ var init_sovereign_conduit = __esm({
|
|
|
20681
20730
|
external_expression: "the boundaries are clear and the system feels safe to operate inside"
|
|
20682
20731
|
},
|
|
20683
20732
|
{
|
|
20684
|
-
internal_reasoning: "
|
|
20733
|
+
internal_reasoning: "Agency is weakening",
|
|
20685
20734
|
external_expression: "decision ownership is quietly shifting \u2014 the human is accepting AI output without engaging with it"
|
|
20686
20735
|
},
|
|
20687
20736
|
{
|
|
@@ -20764,12 +20813,12 @@ var init_sovereign_conduit = __esm({
|
|
|
20764
20813
|
close_with_strategic_frame: "preferred",
|
|
20765
20814
|
punchline_move: "sparing",
|
|
20766
20815
|
honesty_about_failure: "required",
|
|
20767
|
-
output_translation: `Reason internally through the three-domain frame (Stewardship,
|
|
20816
|
+
output_translation: `Reason internally through the three-domain frame (Stewardship, Agency, Integration). Express externally through the skills inside each domain and the overlap feelings (Trust, Possibility, Responsibility). Do NOT surface the bucket names as labels. Readers understand "the boundaries feel safe" not "Stewardship is strong." Use everyday analogies \u2014 mom rules, friend's house rules, idea calculator. Name the emotion before the mechanism.`
|
|
20768
20817
|
};
|
|
20769
20818
|
SOVEREIGN_CONDUIT_FORBIDDEN = Object.freeze([
|
|
20770
20819
|
// Bucket names as labels
|
|
20771
20820
|
"stewardship is",
|
|
20772
|
-
"
|
|
20821
|
+
"agency is",
|
|
20773
20822
|
"integration is",
|
|
20774
20823
|
// AI-assistant hedging
|
|
20775
20824
|
"it may be beneficial to consider",
|
|
@@ -20805,7 +20854,7 @@ var init_sovereign_conduit = __esm({
|
|
|
20805
20854
|
"Here's what's actually happening: [plain explanation].",
|
|
20806
20855
|
"The question to ask yourself: [question].",
|
|
20807
20856
|
"The difference between [A] and [B] matters here: [why].",
|
|
20808
|
-
//
|
|
20857
|
+
// Agency checks
|
|
20809
20858
|
"Are you still the author of this decision, or did the AI make it for you?",
|
|
20810
20859
|
"The AI extended your thinking here. That's working.",
|
|
20811
20860
|
"The AI replaced your thinking here. That's the drift to watch.",
|
|
@@ -20816,7 +20865,7 @@ var init_sovereign_conduit = __esm({
|
|
|
20816
20865
|
]);
|
|
20817
20866
|
SOVEREIGN_CONDUIT_STRATEGIC = Object.freeze([
|
|
20818
20867
|
"Safety before expansion \u2014 always. No exception.",
|
|
20819
|
-
"
|
|
20868
|
+
"Agency before convenience \u2014 the right to think for yourself is not a feature to optimize away.",
|
|
20820
20869
|
"Extension, not replacement \u2014 AI should make your thinking bigger, not do your thinking for you.",
|
|
20821
20870
|
"Diversity over uniformity \u2014 different thinkers produce different ideas, and that's the engine of progress.",
|
|
20822
20871
|
"The rules should be visible \u2014 like a good house, you know the rules before you walk in.",
|
|
@@ -20826,16 +20875,16 @@ var init_sovereign_conduit = __esm({
|
|
|
20826
20875
|
]);
|
|
20827
20876
|
SOVEREIGN_CONDUIT_EXEMPLARS = Object.freeze([
|
|
20828
20877
|
{
|
|
20829
|
-
path: "neuroverseos-sovereign-conduit.worldmodel.md",
|
|
20878
|
+
path: "src/radiant/examples/neuroverse-base/neuroverseos-sovereign-conduit.worldmodel.md",
|
|
20830
20879
|
title: "The Sovereign Conduit Worldmodel",
|
|
20831
|
-
exhibits: ["stewardship", "
|
|
20880
|
+
exhibits: ["stewardship", "agency", "integration"],
|
|
20832
20881
|
integration_quality: "full \u2014 all three domains defined, overlaps named, center identity declared",
|
|
20833
20882
|
notes: 'The source worldmodel. The tagline "Humanity first. In constant learning. In shared teaching." is the voice compressed to its essence. Use this as the north star for tone calibration.'
|
|
20834
20883
|
}
|
|
20835
20884
|
]);
|
|
20836
20885
|
sovereignConduitLens = {
|
|
20837
20886
|
name: "sovereign-conduit",
|
|
20838
|
-
description: "The NeuroVerseOS base lens. Warm, accessible, teaching. Evaluates activity through Stewardship (safety),
|
|
20887
|
+
description: "The NeuroVerseOS base lens. Warm, accessible, teaching. Evaluates activity through Stewardship (safety), Agency (authority over thinking), and Integration (AI as cognitive extension). Uses everyday analogies \u2014 mom rules, friend's house, idea calculator. Names emotions before mechanisms. If a non-technical person can't understand the output, the voice is wrong. Humanity first. In constant learning. In shared teaching.",
|
|
20839
20888
|
primary_frame: {
|
|
20840
20889
|
domains: SOVEREIGN_CONDUIT_FRAME.domains,
|
|
20841
20890
|
overlaps: SOVEREIGN_CONDUIT_FRAME.overlaps,
|
|
@@ -21783,82 +21832,638 @@ var init_notion = __esm({
|
|
|
21783
21832
|
}
|
|
21784
21833
|
});
|
|
21785
21834
|
|
|
21835
|
+
// src/radiant/adapters/linear.ts
|
|
21836
|
+
async function fetchLinearActivity(apiKey, options = {}) {
|
|
21837
|
+
const windowDays = options.windowDays ?? 14;
|
|
21838
|
+
const maxIssues = options.maxIssues ?? 200;
|
|
21839
|
+
const since = new Date(Date.now() - windowDays * 24 * 60 * 60 * 1e3);
|
|
21840
|
+
const sinceIso = since.toISOString();
|
|
21841
|
+
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
21842
|
+
const teamFilter = options.teamIds && options.teamIds.length > 0 ? `team: { id: { in: [${options.teamIds.map((t) => JSON.stringify(t)).join(", ")}] } }` : "";
|
|
21843
|
+
const issuesQuery = `
|
|
21844
|
+
query RadiantIssues($since: DateTimeOrDuration!, $first: Int!) {
|
|
21845
|
+
issues(
|
|
21846
|
+
filter: {
|
|
21847
|
+
updatedAt: { gte: $since }
|
|
21848
|
+
${teamFilter}
|
|
21849
|
+
}
|
|
21850
|
+
first: $first
|
|
21851
|
+
orderBy: updatedAt
|
|
21852
|
+
) {
|
|
21853
|
+
nodes {
|
|
21854
|
+
id
|
|
21855
|
+
identifier
|
|
21856
|
+
title
|
|
21857
|
+
url
|
|
21858
|
+
createdAt
|
|
21859
|
+
updatedAt
|
|
21860
|
+
completedAt
|
|
21861
|
+
canceledAt
|
|
21862
|
+
state { name type }
|
|
21863
|
+
assignee { id name email }
|
|
21864
|
+
creator { id name }
|
|
21865
|
+
team { id name }
|
|
21866
|
+
project { id name }
|
|
21867
|
+
cycle { id number startsAt endsAt }
|
|
21868
|
+
comments(first: 20) {
|
|
21869
|
+
nodes { id body createdAt user { id name } }
|
|
21870
|
+
}
|
|
21871
|
+
}
|
|
21872
|
+
}
|
|
21873
|
+
}
|
|
21874
|
+
`;
|
|
21875
|
+
const cyclesQuery = `
|
|
21876
|
+
query RadiantCycles($since: DateTimeOrDuration!, $now: DateTimeOrDuration!) {
|
|
21877
|
+
cycles(
|
|
21878
|
+
filter: { endsAt: { gte: $since, lte: $now } }
|
|
21879
|
+
first: 20
|
|
21880
|
+
) {
|
|
21881
|
+
nodes {
|
|
21882
|
+
id
|
|
21883
|
+
number
|
|
21884
|
+
startsAt
|
|
21885
|
+
endsAt
|
|
21886
|
+
issueCountHistory
|
|
21887
|
+
completedIssueCountHistory
|
|
21888
|
+
team { id name }
|
|
21889
|
+
}
|
|
21890
|
+
}
|
|
21891
|
+
}
|
|
21892
|
+
`;
|
|
21893
|
+
const [issuesResponse, cyclesResponse] = await Promise.all([
|
|
21894
|
+
fetchLinearGraphQL(apiKey, issuesQuery, {
|
|
21895
|
+
since: sinceIso,
|
|
21896
|
+
first: maxIssues
|
|
21897
|
+
}),
|
|
21898
|
+
fetchLinearGraphQL(apiKey, cyclesQuery, {
|
|
21899
|
+
since: sinceIso,
|
|
21900
|
+
now: nowIso
|
|
21901
|
+
})
|
|
21902
|
+
]);
|
|
21903
|
+
const rawIssues = issuesResponse.issues?.nodes ?? [];
|
|
21904
|
+
const rawCycles = cyclesResponse.cycles?.nodes ?? [];
|
|
21905
|
+
const events = [];
|
|
21906
|
+
const assignees = /* @__PURE__ */ new Set();
|
|
21907
|
+
const projects = /* @__PURE__ */ new Map();
|
|
21908
|
+
let issuesCreated = 0;
|
|
21909
|
+
let issuesCompleted = 0;
|
|
21910
|
+
let issuesOpen = 0;
|
|
21911
|
+
let issuesStalled = 0;
|
|
21912
|
+
let commentsTotal = 0;
|
|
21913
|
+
const now = Date.now();
|
|
21914
|
+
const stallThresholdMs = 14 * 24 * 60 * 60 * 1e3;
|
|
21915
|
+
for (const issue of rawIssues) {
|
|
21916
|
+
const created = new Date(issue.createdAt);
|
|
21917
|
+
const updated = new Date(issue.updatedAt);
|
|
21918
|
+
const completed = issue.completedAt ? new Date(issue.completedAt) : null;
|
|
21919
|
+
const assigneeId = issue.assignee?.id ?? "unassigned";
|
|
21920
|
+
if (assigneeId !== "unassigned") assignees.add(assigneeId);
|
|
21921
|
+
if (issue.project) {
|
|
21922
|
+
projects.set(issue.project.name, (projects.get(issue.project.name) ?? 0) + 1);
|
|
21923
|
+
}
|
|
21924
|
+
const actor = {
|
|
21925
|
+
id: assigneeId,
|
|
21926
|
+
kind: "human",
|
|
21927
|
+
name: issue.assignee?.name ?? "unassigned"
|
|
21928
|
+
};
|
|
21929
|
+
if (created >= since) {
|
|
21930
|
+
issuesCreated++;
|
|
21931
|
+
events.push({
|
|
21932
|
+
id: `linear-created-${issue.id}`,
|
|
21933
|
+
timestamp: issue.createdAt,
|
|
21934
|
+
actor: {
|
|
21935
|
+
id: issue.creator?.id ?? "unknown",
|
|
21936
|
+
kind: "human",
|
|
21937
|
+
name: issue.creator?.name ?? "unknown"
|
|
21938
|
+
},
|
|
21939
|
+
kind: "issue_created",
|
|
21940
|
+
content: `[${issue.identifier}] ${issue.title}`,
|
|
21941
|
+
metadata: {
|
|
21942
|
+
issueId: issue.id,
|
|
21943
|
+
url: issue.url,
|
|
21944
|
+
team: issue.team?.name,
|
|
21945
|
+
project: issue.project?.name,
|
|
21946
|
+
state: issue.state?.name
|
|
21947
|
+
}
|
|
21948
|
+
});
|
|
21949
|
+
}
|
|
21950
|
+
if (completed && completed >= since) {
|
|
21951
|
+
issuesCompleted++;
|
|
21952
|
+
events.push({
|
|
21953
|
+
id: `linear-completed-${issue.id}`,
|
|
21954
|
+
timestamp: issue.completedAt,
|
|
21955
|
+
actor,
|
|
21956
|
+
kind: "issue_completed",
|
|
21957
|
+
content: `[${issue.identifier}] ${issue.title}`,
|
|
21958
|
+
metadata: {
|
|
21959
|
+
issueId: issue.id,
|
|
21960
|
+
url: issue.url,
|
|
21961
|
+
team: issue.team?.name,
|
|
21962
|
+
project: issue.project?.name,
|
|
21963
|
+
cycleDays: issue.cycle?.startsAt && issue.completedAt ? Math.round(
|
|
21964
|
+
(new Date(issue.completedAt).getTime() - new Date(issue.cycle.startsAt).getTime()) / (24 * 60 * 60 * 1e3)
|
|
21965
|
+
) : null
|
|
21966
|
+
}
|
|
21967
|
+
});
|
|
21968
|
+
}
|
|
21969
|
+
if (!completed && !issue.canceledAt) {
|
|
21970
|
+
issuesOpen++;
|
|
21971
|
+
const isInProgress = issue.state?.type === "started";
|
|
21972
|
+
const idleMs = now - updated.getTime();
|
|
21973
|
+
if (isInProgress && idleMs > stallThresholdMs) issuesStalled++;
|
|
21974
|
+
}
|
|
21975
|
+
for (const comment of issue.comments?.nodes ?? []) {
|
|
21976
|
+
const commentedAt = new Date(comment.createdAt);
|
|
21977
|
+
if (commentedAt < since) continue;
|
|
21978
|
+
commentsTotal++;
|
|
21979
|
+
events.push({
|
|
21980
|
+
id: `linear-comment-${comment.id}`,
|
|
21981
|
+
timestamp: comment.createdAt,
|
|
21982
|
+
actor: {
|
|
21983
|
+
id: comment.user?.id ?? "unknown",
|
|
21984
|
+
kind: "human",
|
|
21985
|
+
name: comment.user?.name ?? "unknown"
|
|
21986
|
+
},
|
|
21987
|
+
kind: "issue_comment",
|
|
21988
|
+
content: comment.body.slice(0, 280),
|
|
21989
|
+
metadata: {
|
|
21990
|
+
issueId: issue.id,
|
|
21991
|
+
issueIdentifier: issue.identifier,
|
|
21992
|
+
url: issue.url
|
|
21993
|
+
}
|
|
21994
|
+
});
|
|
21995
|
+
}
|
|
21996
|
+
}
|
|
21997
|
+
let cycleCompletionRate = null;
|
|
21998
|
+
if (rawCycles.length > 0) {
|
|
21999
|
+
const rates = [];
|
|
22000
|
+
for (const cycle of rawCycles) {
|
|
22001
|
+
const committed = cycle.issueCountHistory?.at(0) ?? 0;
|
|
22002
|
+
const completed = cycle.completedIssueCountHistory?.at(-1) ?? 0;
|
|
22003
|
+
if (committed > 0) rates.push(completed / committed);
|
|
22004
|
+
}
|
|
22005
|
+
if (rates.length > 0) {
|
|
22006
|
+
cycleCompletionRate = Math.round(rates.reduce((a, b) => a + b, 0) / rates.length * 100) / 100;
|
|
22007
|
+
}
|
|
22008
|
+
}
|
|
22009
|
+
const topProjects = [...projects.entries()].sort((a, b) => b[1] - a[1]).slice(0, 5).map(([name]) => name);
|
|
22010
|
+
const signals = {
|
|
22011
|
+
issuesCreated,
|
|
22012
|
+
issuesCompleted,
|
|
22013
|
+
issuesOpen,
|
|
22014
|
+
issuesStalled,
|
|
22015
|
+
cycleCompletionRate,
|
|
22016
|
+
uniqueAssignees: assignees.size,
|
|
22017
|
+
commentsTotal,
|
|
22018
|
+
topProjects
|
|
22019
|
+
};
|
|
22020
|
+
events.sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp));
|
|
22021
|
+
return { events, signals };
|
|
22022
|
+
}
|
|
22023
|
+
function formatLinearSignalsForPrompt(signals) {
|
|
22024
|
+
if (signals.issuesCreated === 0 && signals.issuesCompleted === 0 && signals.issuesOpen === 0) {
|
|
22025
|
+
return "";
|
|
22026
|
+
}
|
|
22027
|
+
const lines = [
|
|
22028
|
+
"## Linear Activity (planned work vs. shipped outcome)",
|
|
22029
|
+
"",
|
|
22030
|
+
`${signals.issuesCreated} issues created, ${signals.issuesCompleted} completed in window.`,
|
|
22031
|
+
`${signals.issuesOpen} issues still open.`
|
|
22032
|
+
];
|
|
22033
|
+
if (signals.issuesStalled > 0) {
|
|
22034
|
+
lines.push(
|
|
22035
|
+
`${signals.issuesStalled} in-progress issues haven't moved in 14+ days (stalled).`
|
|
22036
|
+
);
|
|
22037
|
+
}
|
|
22038
|
+
if (signals.cycleCompletionRate !== null) {
|
|
22039
|
+
const pct = Math.round(signals.cycleCompletionRate * 100);
|
|
22040
|
+
lines.push(`Cycles ended in window completed ${pct}% of what was committed.`);
|
|
22041
|
+
}
|
|
22042
|
+
if (signals.uniqueAssignees > 0) {
|
|
22043
|
+
lines.push(`${signals.uniqueAssignees} unique assignees active.`);
|
|
22044
|
+
}
|
|
22045
|
+
if (signals.commentsTotal > 0) {
|
|
22046
|
+
lines.push(`${signals.commentsTotal} comments across issues in window.`);
|
|
22047
|
+
}
|
|
22048
|
+
if (signals.topProjects.length > 0) {
|
|
22049
|
+
lines.push(`Most active projects: ${signals.topProjects.join(", ")}.`);
|
|
22050
|
+
}
|
|
22051
|
+
lines.push("");
|
|
22052
|
+
lines.push("Linear is where the team states what it will build.");
|
|
22053
|
+
lines.push("GitHub is where the team reveals what actually got built.");
|
|
22054
|
+
lines.push("Low completion rate + high creation rate = planning faster than shipping.");
|
|
22055
|
+
lines.push("High stalled count = commitments made but not honored.");
|
|
22056
|
+
lines.push("Compare Linear signals against GitHub to find the stated-vs-shipped gap.");
|
|
22057
|
+
return lines.join("\n");
|
|
22058
|
+
}
|
|
22059
|
+
async function fetchLinearGraphQL(apiKey, query, variables) {
|
|
22060
|
+
const res = await fetch("https://api.linear.app/graphql", {
|
|
22061
|
+
method: "POST",
|
|
22062
|
+
headers: {
|
|
22063
|
+
// Linear accepts the raw API key in Authorization with no "Bearer" prefix.
|
|
22064
|
+
Authorization: apiKey,
|
|
22065
|
+
"Content-Type": "application/json"
|
|
22066
|
+
},
|
|
22067
|
+
body: JSON.stringify({ query, variables })
|
|
22068
|
+
});
|
|
22069
|
+
if (!res.ok) {
|
|
22070
|
+
throw new Error(
|
|
22071
|
+
`Linear API error ${res.status}: ${(await res.text()).slice(0, 300)}`
|
|
22072
|
+
);
|
|
22073
|
+
}
|
|
22074
|
+
const json = await res.json();
|
|
22075
|
+
if (json.errors && json.errors.length > 0) {
|
|
22076
|
+
throw new Error(
|
|
22077
|
+
`Linear GraphQL errors: ${json.errors.map((e) => e.message).join("; ")}`
|
|
22078
|
+
);
|
|
22079
|
+
}
|
|
22080
|
+
if (!json.data) {
|
|
22081
|
+
throw new Error("Linear API returned no data");
|
|
22082
|
+
}
|
|
22083
|
+
return json.data;
|
|
22084
|
+
}
|
|
22085
|
+
var init_linear = __esm({
|
|
22086
|
+
"src/radiant/adapters/linear.ts"() {
|
|
22087
|
+
"use strict";
|
|
22088
|
+
}
|
|
22089
|
+
});
|
|
22090
|
+
|
|
22091
|
+
// src/radiant/core/git-remote.ts
|
|
22092
|
+
function resolveGitConfigPath(repoDir) {
|
|
22093
|
+
const dotGit = (0, import_path14.join)(repoDir, ".git");
|
|
22094
|
+
if (!(0, import_fs13.existsSync)(dotGit)) return null;
|
|
22095
|
+
try {
|
|
22096
|
+
const stat = (0, import_fs13.statSync)(dotGit);
|
|
22097
|
+
if (stat.isDirectory()) {
|
|
22098
|
+
return (0, import_path14.join)(dotGit, "config");
|
|
22099
|
+
}
|
|
22100
|
+
if (stat.isFile()) {
|
|
22101
|
+
const content = (0, import_fs13.readFileSync)(dotGit, "utf-8");
|
|
22102
|
+
const match = /^gitdir:\s*(.+)$/m.exec(content);
|
|
22103
|
+
if (!match) return null;
|
|
22104
|
+
const gitDir = (0, import_path14.resolve)(repoDir, match[1].trim());
|
|
22105
|
+
const configPath = (0, import_path14.join)(gitDir, "config");
|
|
22106
|
+
return (0, import_fs13.existsSync)(configPath) ? configPath : null;
|
|
22107
|
+
}
|
|
22108
|
+
} catch {
|
|
22109
|
+
return null;
|
|
22110
|
+
}
|
|
22111
|
+
return null;
|
|
22112
|
+
}
|
|
22113
|
+
function readOriginRemote(repoDir) {
|
|
22114
|
+
const configPath = resolveGitConfigPath(repoDir);
|
|
22115
|
+
if (!configPath) return null;
|
|
22116
|
+
try {
|
|
22117
|
+
const raw = (0, import_fs13.readFileSync)(configPath, "utf-8");
|
|
22118
|
+
const sectionRe = /\[remote "origin"\]\s*\n((?:(?!\[)[^\n]*\n?)*)/;
|
|
22119
|
+
const section = sectionRe.exec(raw);
|
|
22120
|
+
if (!section) return null;
|
|
22121
|
+
const urlRe = /^\s*url\s*=\s*(.+?)\s*$/m;
|
|
22122
|
+
const url = urlRe.exec(section[1]);
|
|
22123
|
+
return url ? url[1] : null;
|
|
22124
|
+
} catch {
|
|
22125
|
+
return null;
|
|
22126
|
+
}
|
|
22127
|
+
}
|
|
22128
|
+
function parseRemoteUrl(url) {
|
|
22129
|
+
const trimmed = url.trim();
|
|
22130
|
+
if (!trimmed) return null;
|
|
22131
|
+
const ssh = /^git@([^:]+):([^/]+)\/(.+?)(?:\.git)?\/?$/.exec(trimmed);
|
|
22132
|
+
if (ssh) return { host: ssh[1], owner: ssh[2], repo: ssh[3] };
|
|
22133
|
+
const sshProto = /^ssh:\/\/git@([^/]+)\/([^/]+)\/(.+?)(?:\.git)?\/?$/.exec(trimmed);
|
|
22134
|
+
if (sshProto) return { host: sshProto[1], owner: sshProto[2], repo: sshProto[3] };
|
|
22135
|
+
const https = /^https?:\/\/(?:[^@/]+@)?([^/]+)\/([^/]+)\/(.+?)(?:\.git)?\/?$/.exec(trimmed);
|
|
22136
|
+
if (https) return { host: https[1], owner: https[2], repo: https[3] };
|
|
22137
|
+
return null;
|
|
22138
|
+
}
|
|
22139
|
+
function getRepoOrigin(repoDir) {
|
|
22140
|
+
const url = readOriginRemote(repoDir);
|
|
22141
|
+
if (!url) return null;
|
|
22142
|
+
return parseRemoteUrl(url);
|
|
22143
|
+
}
|
|
22144
|
+
var import_fs13, import_path14;
|
|
22145
|
+
var init_git_remote = __esm({
|
|
22146
|
+
"src/radiant/core/git-remote.ts"() {
|
|
22147
|
+
"use strict";
|
|
22148
|
+
import_fs13 = require("fs");
|
|
22149
|
+
import_path14 = require("path");
|
|
22150
|
+
}
|
|
22151
|
+
});
|
|
22152
|
+
|
|
22153
|
+
// src/radiant/core/extends.ts
|
|
22154
|
+
function loadExtendsConfig(repoDir) {
|
|
22155
|
+
const configPath = (0, import_path15.join)(repoDir, ".neuroverse", "config.json");
|
|
22156
|
+
if (!(0, import_fs14.existsSync)(configPath)) return null;
|
|
22157
|
+
try {
|
|
22158
|
+
const raw = (0, import_fs14.readFileSync)(configPath, "utf-8");
|
|
22159
|
+
const parsed = JSON.parse(raw);
|
|
22160
|
+
return parsed;
|
|
22161
|
+
} catch {
|
|
22162
|
+
return null;
|
|
22163
|
+
}
|
|
22164
|
+
}
|
|
22165
|
+
function parseExtendsSpec(raw) {
|
|
22166
|
+
const trimmed = raw.trim();
|
|
22167
|
+
if (!trimmed) return null;
|
|
22168
|
+
if (trimmed.startsWith("github:")) {
|
|
22169
|
+
const rest = trimmed.slice("github:".length);
|
|
22170
|
+
const match = /^([^/]+)\/([^@:]+)(?:@([^:]+))?(?::(.+))?$/.exec(rest);
|
|
22171
|
+
if (!match) return null;
|
|
22172
|
+
return {
|
|
22173
|
+
raw: trimmed,
|
|
22174
|
+
kind: "github",
|
|
22175
|
+
owner: match[1],
|
|
22176
|
+
repo: match[2],
|
|
22177
|
+
ref: match[3] ?? "HEAD",
|
|
22178
|
+
subpath: match[4] ?? ""
|
|
22179
|
+
};
|
|
22180
|
+
}
|
|
22181
|
+
if (trimmed.startsWith("./") || trimmed.startsWith("../") || (0, import_path15.isAbsolute)(trimmed)) {
|
|
22182
|
+
return { raw: trimmed, kind: "local", path: trimmed };
|
|
22183
|
+
}
|
|
22184
|
+
return null;
|
|
22185
|
+
}
|
|
22186
|
+
function getCacheDir(spec, baseCacheDir) {
|
|
22187
|
+
const root = baseCacheDir ?? (0, import_path15.join)((0, import_os5.homedir)(), ".neuroverse", "cache", "extends");
|
|
22188
|
+
const key = (0, import_crypto4.createHash)("sha256").update(spec.raw).digest("hex").slice(0, 16);
|
|
22189
|
+
return (0, import_path15.join)(root, key);
|
|
22190
|
+
}
|
|
22191
|
+
function isCacheFresh(cacheDir, ttlMs) {
|
|
22192
|
+
const stampPath = (0, import_path15.join)(cacheDir, ".neuroverse-fetched");
|
|
22193
|
+
if (!(0, import_fs14.existsSync)(stampPath)) return false;
|
|
22194
|
+
try {
|
|
22195
|
+
const stamp = (0, import_fs14.statSync)(stampPath);
|
|
22196
|
+
return Date.now() - stamp.mtimeMs < ttlMs;
|
|
22197
|
+
} catch {
|
|
22198
|
+
return false;
|
|
22199
|
+
}
|
|
22200
|
+
}
|
|
22201
|
+
function markCacheFresh(cacheDir) {
|
|
22202
|
+
const stampPath = (0, import_path15.join)(cacheDir, ".neuroverse-fetched");
|
|
22203
|
+
try {
|
|
22204
|
+
(0, import_fs14.mkdirSync)(cacheDir, { recursive: true });
|
|
22205
|
+
(0, import_fs14.writeFileSync)(stampPath, (/* @__PURE__ */ new Date()).toISOString());
|
|
22206
|
+
} catch {
|
|
22207
|
+
}
|
|
22208
|
+
}
|
|
22209
|
+
function resolveExtendsSpec(spec, repoDir, options) {
|
|
22210
|
+
if (spec.kind === "local") {
|
|
22211
|
+
const full = (0, import_path15.isAbsolute)(spec.path) ? spec.path : (0, import_path15.resolve)(repoDir, spec.path);
|
|
22212
|
+
if (!(0, import_fs14.existsSync)(full)) {
|
|
22213
|
+
return { spec, dir: null, warning: `local extends path not found: ${full}` };
|
|
22214
|
+
}
|
|
22215
|
+
return { spec, dir: full };
|
|
22216
|
+
}
|
|
22217
|
+
const cacheRoot = options?.cacheDir;
|
|
22218
|
+
const ttl = options?.ttlMs ?? DEFAULT_TTL_MS;
|
|
22219
|
+
const cacheDir = getCacheDir(spec, cacheRoot);
|
|
22220
|
+
const fresh = isCacheFresh(cacheDir, ttl);
|
|
22221
|
+
const needsFetch = options?.forceRefresh || !fresh || !(0, import_fs14.existsSync)(cacheDir);
|
|
22222
|
+
if (needsFetch && options?.noFetch) {
|
|
22223
|
+
if ((0, import_fs14.existsSync)(cacheDir) && (0, import_fs14.existsSync)((0, import_path15.join)(cacheDir, ".neuroverse-fetched"))) {
|
|
22224
|
+
return resolveSubpath(spec, cacheDir);
|
|
22225
|
+
}
|
|
22226
|
+
return options?.silentOnMissing ? { spec, dir: null } : { spec, dir: null, warning: `NEUROVERSE_NO_FETCH set and no cache for ${spec.raw}` };
|
|
22227
|
+
}
|
|
22228
|
+
if (needsFetch) {
|
|
22229
|
+
const fetcher = options?.fetcher ?? defaultGitFetcher;
|
|
22230
|
+
try {
|
|
22231
|
+
fetcher(spec, cacheDir);
|
|
22232
|
+
markCacheFresh(cacheDir);
|
|
22233
|
+
} catch (err) {
|
|
22234
|
+
if ((0, import_fs14.existsSync)(cacheDir) && (0, import_fs14.existsSync)((0, import_path15.join)(cacheDir, ".neuroverse-fetched"))) {
|
|
22235
|
+
const result = resolveSubpath(spec, cacheDir);
|
|
22236
|
+
return options?.silentOnMissing ? result : { ...result, warning: `fetch failed for ${spec.raw}, using stale cache: ${err.message}` };
|
|
22237
|
+
}
|
|
22238
|
+
return options?.silentOnMissing ? { spec, dir: null } : { spec, dir: null, warning: `fetch failed for ${spec.raw}: ${err.message}` };
|
|
22239
|
+
}
|
|
22240
|
+
}
|
|
22241
|
+
return resolveSubpath(spec, cacheDir);
|
|
22242
|
+
}
|
|
22243
|
+
function resolveSubpath(spec, cacheDir) {
|
|
22244
|
+
const target = spec.subpath ? (0, import_path15.join)(cacheDir, spec.subpath) : cacheDir;
|
|
22245
|
+
if (!(0, import_fs14.existsSync)(target)) {
|
|
22246
|
+
return { spec, dir: null, warning: `subpath not found in ${spec.raw}: ${spec.subpath}` };
|
|
22247
|
+
}
|
|
22248
|
+
if (!spec.subpath) {
|
|
22249
|
+
const candidates = [
|
|
22250
|
+
(0, import_path15.join)(target, "worlds"),
|
|
22251
|
+
(0, import_path15.join)(target, ".neuroverse", "worlds")
|
|
22252
|
+
];
|
|
22253
|
+
for (const c of candidates) {
|
|
22254
|
+
if ((0, import_fs14.existsSync)(c)) return { spec, dir: c };
|
|
22255
|
+
}
|
|
22256
|
+
}
|
|
22257
|
+
return { spec, dir: target };
|
|
22258
|
+
}
|
|
22259
|
+
function detectOrgExtendsSpec(repoDir) {
|
|
22260
|
+
const origin = getRepoOrigin(repoDir);
|
|
22261
|
+
if (!origin) return null;
|
|
22262
|
+
if (origin.host !== "github.com") return null;
|
|
22263
|
+
if (origin.repo === "worlds") return null;
|
|
22264
|
+
return {
|
|
22265
|
+
raw: `github:${origin.owner}/worlds`,
|
|
22266
|
+
kind: "github",
|
|
22267
|
+
owner: origin.owner,
|
|
22268
|
+
repo: "worlds",
|
|
22269
|
+
ref: "HEAD",
|
|
22270
|
+
subpath: ""
|
|
22271
|
+
};
|
|
22272
|
+
}
|
|
22273
|
+
function resolveAllExtends(repoDir, options) {
|
|
22274
|
+
const config = options?.config !== void 0 ? options.config : loadExtendsConfig(repoDir);
|
|
22275
|
+
if (!config?.extends || config.extends.length === 0) return [];
|
|
22276
|
+
const results = [];
|
|
22277
|
+
for (const raw of config.extends) {
|
|
22278
|
+
const spec = parseExtendsSpec(raw);
|
|
22279
|
+
if (!spec) {
|
|
22280
|
+
results.push({
|
|
22281
|
+
spec: { raw, kind: "local" },
|
|
22282
|
+
dir: null,
|
|
22283
|
+
warning: `unparseable extends spec: ${raw}`
|
|
22284
|
+
});
|
|
22285
|
+
continue;
|
|
22286
|
+
}
|
|
22287
|
+
results.push(resolveExtendsSpec(spec, repoDir, options));
|
|
22288
|
+
}
|
|
22289
|
+
return results;
|
|
22290
|
+
}
|
|
22291
|
+
var import_fs14, import_path15, import_os5, import_crypto4, import_child_process2, DEFAULT_TTL_MS, defaultGitFetcher;
|
|
22292
|
+
var init_extends = __esm({
|
|
22293
|
+
"src/radiant/core/extends.ts"() {
|
|
22294
|
+
"use strict";
|
|
22295
|
+
import_fs14 = require("fs");
|
|
22296
|
+
import_path15 = require("path");
|
|
22297
|
+
import_os5 = require("os");
|
|
22298
|
+
import_crypto4 = require("crypto");
|
|
22299
|
+
import_child_process2 = require("child_process");
|
|
22300
|
+
init_git_remote();
|
|
22301
|
+
DEFAULT_TTL_MS = 60 * 60 * 1e3;
|
|
22302
|
+
defaultGitFetcher = (spec, destDir) => {
|
|
22303
|
+
if (spec.kind !== "github") return;
|
|
22304
|
+
const url = `https://github.com/${spec.owner}/${spec.repo}.git`;
|
|
22305
|
+
const parent = (0, import_path15.resolve)(destDir, "..");
|
|
22306
|
+
(0, import_fs14.mkdirSync)(parent, { recursive: true });
|
|
22307
|
+
if ((0, import_fs14.existsSync)(destDir)) {
|
|
22308
|
+
(0, import_fs14.rmSync)(destDir, { recursive: true, force: true });
|
|
22309
|
+
}
|
|
22310
|
+
const args = ["clone", "--depth", "1", "--filter=blob:none"];
|
|
22311
|
+
if (spec.ref && spec.ref !== "HEAD") {
|
|
22312
|
+
args.push("--branch", spec.ref);
|
|
22313
|
+
}
|
|
22314
|
+
args.push(url, destDir);
|
|
22315
|
+
(0, import_child_process2.execFileSync)("git", args, { stdio: "pipe" });
|
|
22316
|
+
};
|
|
22317
|
+
}
|
|
22318
|
+
});
|
|
22319
|
+
|
|
21786
22320
|
// src/radiant/core/discovery.ts
|
|
21787
22321
|
function discoverWorlds(options) {
|
|
21788
22322
|
const worlds = [];
|
|
21789
|
-
const
|
|
21790
|
-
|
|
22323
|
+
const warnings = [];
|
|
22324
|
+
const forceRefresh = process.env.NEUROVERSE_REFRESH === "1";
|
|
22325
|
+
const noFetch = process.env.NEUROVERSE_NO_FETCH === "1";
|
|
22326
|
+
const noOrg = options?.disableOrg || process.env.NEUROVERSE_NO_ORG === "1";
|
|
22327
|
+
const userDir = options?.userWorldsDir ?? (0, import_path16.join)((0, import_os6.homedir)(), ".neuroverse", "worlds");
|
|
22328
|
+
if ((0, import_fs15.existsSync)(userDir)) {
|
|
21791
22329
|
worlds.push(...loadWorldsFromDir(userDir, "user"));
|
|
21792
22330
|
}
|
|
22331
|
+
if (!noOrg && !options?.explicitWorldsDir) {
|
|
22332
|
+
const specs = [];
|
|
22333
|
+
if (options?.repoDir) {
|
|
22334
|
+
const fromGit = detectOrgExtendsSpec(options.repoDir);
|
|
22335
|
+
if (fromGit) specs.push(fromGit);
|
|
22336
|
+
}
|
|
22337
|
+
if (options?.scopeOwner) {
|
|
22338
|
+
const already = specs.some(
|
|
22339
|
+
(s) => s.owner?.toLowerCase() === options.scopeOwner.toLowerCase()
|
|
22340
|
+
);
|
|
22341
|
+
if (!already) {
|
|
22342
|
+
specs.push({
|
|
22343
|
+
raw: `github:${options.scopeOwner}/worlds`,
|
|
22344
|
+
kind: "github",
|
|
22345
|
+
owner: options.scopeOwner,
|
|
22346
|
+
repo: "worlds"
|
|
22347
|
+
});
|
|
22348
|
+
}
|
|
22349
|
+
}
|
|
22350
|
+
const baseDir = options?.repoDir ?? process.cwd();
|
|
22351
|
+
for (const spec of specs) {
|
|
22352
|
+
const result = resolveExtendsSpec(spec, baseDir, {
|
|
22353
|
+
cacheDir: options?.extendsCacheDir,
|
|
22354
|
+
fetcher: options?.extendsFetcher,
|
|
22355
|
+
ttlMs: options?.extendsTtlMs,
|
|
22356
|
+
forceRefresh,
|
|
22357
|
+
noFetch,
|
|
22358
|
+
silentOnMissing: true
|
|
22359
|
+
});
|
|
22360
|
+
worlds.push(...loadExtendsWorlds(result, "org"));
|
|
22361
|
+
}
|
|
22362
|
+
}
|
|
22363
|
+
if (options?.repoDir && !options.disableExtends && !options.explicitWorldsDir) {
|
|
22364
|
+
const results = resolveAllExtends(options.repoDir, {
|
|
22365
|
+
cacheDir: options.extendsCacheDir,
|
|
22366
|
+
fetcher: options.extendsFetcher,
|
|
22367
|
+
ttlMs: options.extendsTtlMs,
|
|
22368
|
+
forceRefresh,
|
|
22369
|
+
noFetch
|
|
22370
|
+
});
|
|
22371
|
+
for (const result of results) {
|
|
22372
|
+
worlds.push(...loadExtendsWorlds(result, "extends"));
|
|
22373
|
+
if (result.warning) warnings.push(result.warning);
|
|
22374
|
+
}
|
|
22375
|
+
}
|
|
21793
22376
|
if (options?.explicitWorldsDir) {
|
|
21794
22377
|
worlds.push(...loadWorldsFromDir(options.explicitWorldsDir, "repo"));
|
|
21795
22378
|
} else if (options?.repoDir) {
|
|
21796
22379
|
const repoPaths = [
|
|
21797
|
-
(0,
|
|
21798
|
-
(0,
|
|
22380
|
+
(0, import_path16.join)(options.repoDir, "worlds"),
|
|
22381
|
+
(0, import_path16.join)(options.repoDir, ".neuroverse", "worlds")
|
|
21799
22382
|
];
|
|
21800
22383
|
for (const p of repoPaths) {
|
|
21801
|
-
if ((0,
|
|
22384
|
+
if ((0, import_fs15.existsSync)(p)) {
|
|
21802
22385
|
worlds.push(...loadWorldsFromDir(p, "repo"));
|
|
21803
22386
|
break;
|
|
21804
22387
|
}
|
|
21805
22388
|
}
|
|
21806
22389
|
}
|
|
21807
|
-
const combinedContent = worlds.map((w) =>
|
|
21808
|
-
${w.
|
|
22390
|
+
const combinedContent = worlds.map((w) => {
|
|
22391
|
+
const tag = w.extendsFrom ? `<!-- world: ${w.name} (${w.source} ${w.extendsFrom}) -->` : `<!-- world: ${w.name} (${w.source}) -->`;
|
|
22392
|
+
return `${tag}
|
|
22393
|
+
${w.content}`;
|
|
22394
|
+
}).join("\n\n---\n\n");
|
|
21809
22395
|
const summary2 = worlds.length === 0 ? "no worlds discovered" : worlds.map((w) => `${w.name} (${w.source})`).join(", ");
|
|
21810
|
-
return { worlds, combinedContent, summary: summary2 };
|
|
22396
|
+
return { worlds, combinedContent, summary: summary2, warnings };
|
|
22397
|
+
}
|
|
22398
|
+
function formatActiveWorlds(stack) {
|
|
22399
|
+
if (stack.worlds.length === 0) return "No worlds loaded.";
|
|
22400
|
+
const lines = ["ACTIVE WORLDS", ""];
|
|
22401
|
+
for (const w of stack.worlds) {
|
|
22402
|
+
const sourceLabel = w.source === "base" ? "universal" : w.source === "user" ? "personal" : w.source === "org" ? `org (${w.extendsFrom ?? "auto"})` : w.source === "extends" ? `shared (${w.extendsFrom ?? "extends"})` : "this repo";
|
|
22403
|
+
lines.push(` ${w.name} (${sourceLabel})`);
|
|
22404
|
+
}
|
|
22405
|
+
if (stack.warnings.length > 0) {
|
|
22406
|
+
lines.push("", "WARNINGS");
|
|
22407
|
+
for (const w of stack.warnings) lines.push(` ${w}`);
|
|
22408
|
+
}
|
|
22409
|
+
return lines.join("\n");
|
|
22410
|
+
}
|
|
22411
|
+
function loadExtendsWorlds(result, source) {
|
|
22412
|
+
if (!result.dir) return [];
|
|
22413
|
+
const loaded = loadWorldsFromDir(result.dir, source);
|
|
22414
|
+
return loaded.map((w) => ({ ...w, extendsFrom: result.spec.raw }));
|
|
21811
22415
|
}
|
|
21812
22416
|
function loadWorldsFromDir(dirPath, source) {
|
|
21813
|
-
const dir = (0,
|
|
21814
|
-
if (!(0,
|
|
21815
|
-
const stat = (0,
|
|
22417
|
+
const dir = (0, import_path16.resolve)(dirPath);
|
|
22418
|
+
if (!(0, import_fs15.existsSync)(dir)) return [];
|
|
22419
|
+
const stat = (0, import_fs15.statSync)(dir);
|
|
21816
22420
|
if (stat.isFile() && dir.endsWith(".md")) {
|
|
21817
22421
|
try {
|
|
21818
22422
|
return [{
|
|
21819
|
-
name: (0,
|
|
22423
|
+
name: (0, import_path16.basename)(dir).replace(/\.worldmodel\.md$/, "").replace(/\.nv-world\.md$/, ""),
|
|
21820
22424
|
source,
|
|
21821
22425
|
path: dir,
|
|
21822
|
-
content: (0,
|
|
22426
|
+
content: (0, import_fs15.readFileSync)(dir, "utf-8")
|
|
21823
22427
|
}];
|
|
21824
22428
|
} catch {
|
|
21825
22429
|
return [];
|
|
21826
22430
|
}
|
|
21827
22431
|
}
|
|
21828
22432
|
if (!stat.isDirectory()) return [];
|
|
21829
|
-
const files = (0,
|
|
22433
|
+
const files = (0, import_fs15.readdirSync)(dir).filter(
|
|
21830
22434
|
(f) => f.endsWith(".worldmodel.md") || f.endsWith(".nv-world.md")
|
|
21831
22435
|
).sort();
|
|
21832
22436
|
return files.map((f) => {
|
|
21833
|
-
const fullPath = (0,
|
|
22437
|
+
const fullPath = (0, import_path16.join)(dir, f);
|
|
21834
22438
|
return {
|
|
21835
22439
|
name: f.replace(/\.worldmodel\.md$/, "").replace(/\.nv-world\.md$/, ""),
|
|
21836
22440
|
source,
|
|
21837
22441
|
path: fullPath,
|
|
21838
|
-
content: (0,
|
|
22442
|
+
content: (0, import_fs15.readFileSync)(fullPath, "utf-8")
|
|
21839
22443
|
};
|
|
21840
22444
|
});
|
|
21841
22445
|
}
|
|
21842
|
-
var
|
|
22446
|
+
var import_fs15, import_path16, import_os6;
|
|
21843
22447
|
var init_discovery = __esm({
|
|
21844
22448
|
"src/radiant/core/discovery.ts"() {
|
|
21845
22449
|
"use strict";
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
22450
|
+
import_fs15 = require("fs");
|
|
22451
|
+
import_path16 = require("path");
|
|
22452
|
+
import_os6 = require("os");
|
|
22453
|
+
init_extends();
|
|
21849
22454
|
}
|
|
21850
22455
|
});
|
|
21851
22456
|
|
|
21852
22457
|
// src/radiant/adapters/exocortex.ts
|
|
21853
22458
|
function readExocortex(dirPath, repoName) {
|
|
21854
|
-
const dir = (0,
|
|
22459
|
+
const dir = (0, import_path17.resolve)(dirPath);
|
|
21855
22460
|
let filesLoaded = 0;
|
|
21856
22461
|
function tryRead(...paths) {
|
|
21857
22462
|
for (const p of paths) {
|
|
21858
|
-
const full = (0,
|
|
21859
|
-
if ((0,
|
|
22463
|
+
const full = (0, import_path17.join)(dir, p);
|
|
22464
|
+
if ((0, import_fs16.existsSync)(full)) {
|
|
21860
22465
|
try {
|
|
21861
|
-
const content = (0,
|
|
22466
|
+
const content = (0, import_fs16.readFileSync)(full, "utf-8").trim();
|
|
21862
22467
|
if (content) {
|
|
21863
22468
|
filesLoaded++;
|
|
21864
22469
|
return content;
|
|
@@ -21940,33 +22545,33 @@ function summarizeExocortex(ctx) {
|
|
|
21940
22545
|
if (ctx.methods) loaded.push("methods");
|
|
21941
22546
|
return `${loaded.join(", ")} (${ctx.filesLoaded} files)`;
|
|
21942
22547
|
}
|
|
21943
|
-
var
|
|
22548
|
+
var import_fs16, import_path17;
|
|
21944
22549
|
var init_exocortex = __esm({
|
|
21945
22550
|
"src/radiant/adapters/exocortex.ts"() {
|
|
21946
22551
|
"use strict";
|
|
21947
|
-
|
|
21948
|
-
|
|
22552
|
+
import_fs16 = require("fs");
|
|
22553
|
+
import_path17 = require("path");
|
|
21949
22554
|
}
|
|
21950
22555
|
});
|
|
21951
22556
|
|
|
21952
22557
|
// src/radiant/memory/palace.ts
|
|
21953
22558
|
function writeRead(exocortexDir, frontmatter, text) {
|
|
21954
|
-
const dir = (0,
|
|
21955
|
-
(0,
|
|
22559
|
+
const dir = (0, import_path18.resolve)(exocortexDir, "radiant", "reads");
|
|
22560
|
+
(0, import_fs17.mkdirSync)(dir, { recursive: true });
|
|
21956
22561
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
21957
22562
|
const filename = `${date}.md`;
|
|
21958
|
-
const filepath = (0,
|
|
22563
|
+
const filepath = (0, import_path18.join)(dir, filename);
|
|
21959
22564
|
const content = `${frontmatter}
|
|
21960
22565
|
|
|
21961
22566
|
${text}
|
|
21962
22567
|
`;
|
|
21963
|
-
(0,
|
|
22568
|
+
(0, import_fs17.writeFileSync)(filepath, content, "utf-8");
|
|
21964
22569
|
return filepath;
|
|
21965
22570
|
}
|
|
21966
22571
|
function updateKnowledge(exocortexDir, persistence, options) {
|
|
21967
|
-
const dir = (0,
|
|
21968
|
-
(0,
|
|
21969
|
-
const filepath = (0,
|
|
22572
|
+
const dir = (0, import_path18.resolve)(exocortexDir, "radiant");
|
|
22573
|
+
(0, import_fs17.mkdirSync)(dir, { recursive: true });
|
|
22574
|
+
const filepath = (0, import_path18.join)(dir, "knowledge.md");
|
|
21970
22575
|
const totalReads = options?.totalReads ?? 0;
|
|
21971
22576
|
const existingUntriggered = loadUntriggeredCounts(filepath);
|
|
21972
22577
|
const lines = [
|
|
@@ -22053,14 +22658,14 @@ function updateKnowledge(exocortexDir, persistence, options) {
|
|
|
22053
22658
|
lines.push(`${name}=${count}`);
|
|
22054
22659
|
}
|
|
22055
22660
|
lines.push("-->");
|
|
22056
|
-
(0,
|
|
22661
|
+
(0, import_fs17.writeFileSync)(filepath, lines.join("\n"), "utf-8");
|
|
22057
22662
|
return filepath;
|
|
22058
22663
|
}
|
|
22059
22664
|
function loadUntriggeredCounts(filepath) {
|
|
22060
22665
|
const counts = /* @__PURE__ */ new Map();
|
|
22061
|
-
if (!(0,
|
|
22666
|
+
if (!(0, import_fs17.existsSync)(filepath)) return counts;
|
|
22062
22667
|
try {
|
|
22063
|
-
const content = (0,
|
|
22668
|
+
const content = (0, import_fs17.readFileSync)(filepath, "utf-8");
|
|
22064
22669
|
const match = content.match(
|
|
22065
22670
|
/<!-- untriggered_counts[\s\S]*?-->/
|
|
22066
22671
|
);
|
|
@@ -22078,13 +22683,13 @@ function loadUntriggeredCounts(filepath) {
|
|
|
22078
22683
|
return counts;
|
|
22079
22684
|
}
|
|
22080
22685
|
function loadPriorReads(exocortexDir) {
|
|
22081
|
-
const dir = (0,
|
|
22082
|
-
if (!(0,
|
|
22083
|
-
const files = (0,
|
|
22686
|
+
const dir = (0, import_path18.resolve)(exocortexDir, "radiant", "reads");
|
|
22687
|
+
if (!(0, import_fs17.existsSync)(dir)) return [];
|
|
22688
|
+
const files = (0, import_fs17.readdirSync)(dir).filter((f) => f.endsWith(".md")).sort();
|
|
22084
22689
|
const reads = [];
|
|
22085
22690
|
for (const filename of files) {
|
|
22086
|
-
const filepath = (0,
|
|
22087
|
-
const content = (0,
|
|
22691
|
+
const filepath = (0, import_path18.join)(dir, filename);
|
|
22692
|
+
const content = (0, import_fs17.readFileSync)(filepath, "utf-8");
|
|
22088
22693
|
const date = filename.replace(".md", "");
|
|
22089
22694
|
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
22090
22695
|
const frontmatter = fmMatch ? fmMatch[1] : "";
|
|
@@ -22118,12 +22723,12 @@ function computePersistence(priorReads, currentPatternNames) {
|
|
|
22118
22723
|
dates: dates.sort()
|
|
22119
22724
|
})).sort((a, b) => b.occurrences - a.occurrences);
|
|
22120
22725
|
}
|
|
22121
|
-
var
|
|
22726
|
+
var import_fs17, import_path18;
|
|
22122
22727
|
var init_palace = __esm({
|
|
22123
22728
|
"src/radiant/memory/palace.ts"() {
|
|
22124
22729
|
"use strict";
|
|
22125
|
-
|
|
22126
|
-
|
|
22730
|
+
import_fs17 = require("fs");
|
|
22731
|
+
import_path18 = require("path");
|
|
22127
22732
|
}
|
|
22128
22733
|
});
|
|
22129
22734
|
|
|
@@ -22412,6 +23017,144 @@ var init_signals = __esm({
|
|
|
22412
23017
|
}
|
|
22413
23018
|
});
|
|
22414
23019
|
|
|
23020
|
+
// src/radiant/core/vocabulary.ts
|
|
23021
|
+
function extractDeclaredVocabulary(worldmodelContent) {
|
|
23022
|
+
const aligned = extractSection(worldmodelContent, "Aligned Behaviors").map(
|
|
23023
|
+
(b) => parseBehavior(b, "aligned")
|
|
23024
|
+
);
|
|
23025
|
+
const drift = extractSection(worldmodelContent, "Drift Behaviors").map(
|
|
23026
|
+
(b) => parseBehavior(b, "drift")
|
|
23027
|
+
);
|
|
23028
|
+
const allNames = [...aligned, ...drift].map((p) => p.name);
|
|
23029
|
+
return { aligned, drift, allNames };
|
|
23030
|
+
}
|
|
23031
|
+
function extractSection(content, header) {
|
|
23032
|
+
const escaped = header.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
23033
|
+
const pattern = new RegExp(
|
|
23034
|
+
`##\\s+${escaped}\\s*\\n([\\s\\S]*?)(?=\\n##\\s|$)`,
|
|
23035
|
+
"i"
|
|
23036
|
+
);
|
|
23037
|
+
const match = content.match(pattern);
|
|
23038
|
+
if (!match) return [];
|
|
23039
|
+
const body = match[1];
|
|
23040
|
+
const bullets = body.match(/^[-*]\s+.+$/gm);
|
|
23041
|
+
if (!bullets) return [];
|
|
23042
|
+
return bullets.map((b) => b.replace(/^[-*]\s+/, "").trim()).filter((b) => b.length > 0 && !b.startsWith("<!--"));
|
|
23043
|
+
}
|
|
23044
|
+
function parseBehavior(bullet, kind) {
|
|
23045
|
+
const explicit = bullet.match(
|
|
23046
|
+
/^`?([a-z][a-z0-9_]*)`?\s+[—\u2014-]\s+(.+)$/i
|
|
23047
|
+
);
|
|
23048
|
+
if (explicit && isSnakeCase(explicit[1])) {
|
|
23049
|
+
return {
|
|
23050
|
+
name: explicit[1].toLowerCase(),
|
|
23051
|
+
prose: explicit[2].trim(),
|
|
23052
|
+
kind
|
|
23053
|
+
};
|
|
23054
|
+
}
|
|
23055
|
+
return { name: snakeCaseName(bullet), prose: bullet, kind };
|
|
23056
|
+
}
|
|
23057
|
+
function isSnakeCase(s) {
|
|
23058
|
+
return /^[a-z][a-z0-9_]*$/.test(s);
|
|
23059
|
+
}
|
|
23060
|
+
function snakeCaseName(s) {
|
|
23061
|
+
const base = s.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
23062
|
+
if (base.length <= 60) return base;
|
|
23063
|
+
const truncated = base.slice(0, 60);
|
|
23064
|
+
const lastUnderscore = truncated.lastIndexOf("_");
|
|
23065
|
+
return lastUnderscore > 20 ? truncated.slice(0, lastUnderscore) : truncated;
|
|
23066
|
+
}
|
|
23067
|
+
function matchDeclaredPattern(candidateName, candidateDescription, vocabulary) {
|
|
23068
|
+
const candidateText = `${candidateName.replace(/_/g, " ")} ${candidateDescription}`;
|
|
23069
|
+
const candidateWords = contentWords(candidateText);
|
|
23070
|
+
if (candidateWords.size === 0) return null;
|
|
23071
|
+
let best = null;
|
|
23072
|
+
for (const pattern of [...vocabulary.aligned, ...vocabulary.drift]) {
|
|
23073
|
+
const proseWords = contentWords(pattern.prose);
|
|
23074
|
+
if (proseWords.size === 0) continue;
|
|
23075
|
+
let shared = 0;
|
|
23076
|
+
for (const w of proseWords) {
|
|
23077
|
+
if (candidateWords.has(w)) shared++;
|
|
23078
|
+
}
|
|
23079
|
+
const coverage = shared / proseWords.size;
|
|
23080
|
+
if (shared >= 2 && coverage >= 0.3) {
|
|
23081
|
+
if (!best || coverage > best.score) {
|
|
23082
|
+
best = { pattern, score: coverage };
|
|
23083
|
+
}
|
|
23084
|
+
}
|
|
23085
|
+
}
|
|
23086
|
+
return best?.pattern ?? null;
|
|
23087
|
+
}
|
|
23088
|
+
function contentWords(text) {
|
|
23089
|
+
const words = text.toLowerCase().match(/[a-z][a-z0-9_]+/g) ?? [];
|
|
23090
|
+
return new Set(words.filter((w) => w.length > 3 && !STOPWORDS.has(w)));
|
|
23091
|
+
}
|
|
23092
|
+
var STOPWORDS;
|
|
23093
|
+
var init_vocabulary = __esm({
|
|
23094
|
+
"src/radiant/core/vocabulary.ts"() {
|
|
23095
|
+
"use strict";
|
|
23096
|
+
STOPWORDS = /* @__PURE__ */ new Set([
|
|
23097
|
+
"about",
|
|
23098
|
+
"after",
|
|
23099
|
+
"against",
|
|
23100
|
+
"among",
|
|
23101
|
+
"around",
|
|
23102
|
+
"because",
|
|
23103
|
+
"been",
|
|
23104
|
+
"before",
|
|
23105
|
+
"being",
|
|
23106
|
+
"between",
|
|
23107
|
+
"both",
|
|
23108
|
+
"could",
|
|
23109
|
+
"does",
|
|
23110
|
+
"doing",
|
|
23111
|
+
"during",
|
|
23112
|
+
"each",
|
|
23113
|
+
"from",
|
|
23114
|
+
"further",
|
|
23115
|
+
"have",
|
|
23116
|
+
"having",
|
|
23117
|
+
"into",
|
|
23118
|
+
"itself",
|
|
23119
|
+
"most",
|
|
23120
|
+
"nor",
|
|
23121
|
+
"only",
|
|
23122
|
+
"other",
|
|
23123
|
+
"over",
|
|
23124
|
+
"same",
|
|
23125
|
+
"should",
|
|
23126
|
+
"some",
|
|
23127
|
+
"such",
|
|
23128
|
+
"than",
|
|
23129
|
+
"that",
|
|
23130
|
+
"their",
|
|
23131
|
+
"them",
|
|
23132
|
+
"then",
|
|
23133
|
+
"there",
|
|
23134
|
+
"these",
|
|
23135
|
+
"they",
|
|
23136
|
+
"this",
|
|
23137
|
+
"those",
|
|
23138
|
+
"through",
|
|
23139
|
+
"under",
|
|
23140
|
+
"until",
|
|
23141
|
+
"very",
|
|
23142
|
+
"were",
|
|
23143
|
+
"what",
|
|
23144
|
+
"when",
|
|
23145
|
+
"where",
|
|
23146
|
+
"which",
|
|
23147
|
+
"while",
|
|
23148
|
+
"will",
|
|
23149
|
+
"with",
|
|
23150
|
+
"without",
|
|
23151
|
+
"would",
|
|
23152
|
+
"your",
|
|
23153
|
+
"yours"
|
|
23154
|
+
]);
|
|
23155
|
+
}
|
|
23156
|
+
});
|
|
23157
|
+
|
|
22415
23158
|
// src/radiant/types.ts
|
|
22416
23159
|
function isScored(s) {
|
|
22417
23160
|
return typeof s === "number";
|
|
@@ -22463,7 +23206,11 @@ var init_math = __esm({
|
|
|
22463
23206
|
async function interpretPatterns(input) {
|
|
22464
23207
|
const prompt = buildInterpretationPrompt(input);
|
|
22465
23208
|
const raw = await input.ai.complete(prompt, "Analyze the activity and produce the read.");
|
|
22466
|
-
const
|
|
23209
|
+
const canonicalNames = [
|
|
23210
|
+
...input.canonicalPatterns ?? [],
|
|
23211
|
+
...input.declaredVocabulary?.allNames ?? []
|
|
23212
|
+
];
|
|
23213
|
+
const parsed = parseInterpretation(raw, canonicalNames, input.declaredVocabulary);
|
|
22467
23214
|
return {
|
|
22468
23215
|
patterns: parsed.patterns,
|
|
22469
23216
|
meaning: parsed.meaning,
|
|
@@ -22474,8 +23221,10 @@ async function interpretPatterns(input) {
|
|
|
22474
23221
|
function buildInterpretationPrompt(input) {
|
|
22475
23222
|
const signalSummary = formatSignalSummary(input.signals);
|
|
22476
23223
|
const eventSample = formatEventSample(input.events, 30);
|
|
22477
|
-
const canonicalList = (
|
|
22478
|
-
|
|
23224
|
+
const canonicalList = formatDeclaredVocabulary(
|
|
23225
|
+
input.declaredVocabulary,
|
|
23226
|
+
input.canonicalPatterns ?? []
|
|
23227
|
+
);
|
|
22479
23228
|
const compressedWorld = compressWorldmodel(input.worldmodelContent);
|
|
22480
23229
|
const cl = compressLens(input.lens);
|
|
22481
23230
|
const frame = input.lens.primary_frame;
|
|
@@ -22586,6 +23335,44 @@ Only recommend a move when the evidence actually calls for one.
|
|
|
22586
23335
|
Do NOT use these phrases anywhere in your output:
|
|
22587
23336
|
${forbiddenList}`;
|
|
22588
23337
|
}
|
|
23338
|
+
function formatDeclaredVocabulary(vocabulary, extraNames) {
|
|
23339
|
+
const aligned = vocabulary?.aligned ?? [];
|
|
23340
|
+
const drift = vocabulary?.drift ?? [];
|
|
23341
|
+
if (aligned.length === 0 && drift.length === 0 && extraNames.length === 0) {
|
|
23342
|
+
return 'No patterns have been named yet. Everything you observe is new \u2014 mark it type: "candidate".';
|
|
23343
|
+
}
|
|
23344
|
+
const parts = [];
|
|
23345
|
+
parts.push("## Declared vocabulary (use these names when you see matching evidence)");
|
|
23346
|
+
parts.push("");
|
|
23347
|
+
parts.push(
|
|
23348
|
+
'The worldmodel declares the patterns below. If your observation matches one of these, use the EXACT snake_case name shown and mark type: "canonical" \u2014 do not invent a new name for something that already has one.'
|
|
23349
|
+
);
|
|
23350
|
+
parts.push("");
|
|
23351
|
+
if (aligned.length > 0) {
|
|
23352
|
+
parts.push("### Aligned behaviors (positive patterns)");
|
|
23353
|
+
for (const p of aligned) {
|
|
23354
|
+
parts.push(`- \`${p.name}\` \u2014 ${p.prose}`);
|
|
23355
|
+
}
|
|
23356
|
+
parts.push("");
|
|
23357
|
+
}
|
|
23358
|
+
if (drift.length > 0) {
|
|
23359
|
+
parts.push("### Drift behaviors (negative patterns)");
|
|
23360
|
+
for (const p of drift) {
|
|
23361
|
+
parts.push(`- \`${p.name}\` \u2014 ${p.prose}`);
|
|
23362
|
+
}
|
|
23363
|
+
parts.push("");
|
|
23364
|
+
}
|
|
23365
|
+
if (extraNames.length > 0) {
|
|
23366
|
+
parts.push(
|
|
23367
|
+
`Additional canonical names (from prior runs or caller): ${extraNames.join(", ")}`
|
|
23368
|
+
);
|
|
23369
|
+
parts.push("");
|
|
23370
|
+
}
|
|
23371
|
+
parts.push(
|
|
23372
|
+
'If you observe something genuinely new that matches NO declared pattern, mark it type: "candidate" with a freshly-invented snake_case name.'
|
|
23373
|
+
);
|
|
23374
|
+
return parts.join("\n");
|
|
23375
|
+
}
|
|
22589
23376
|
function formatSignalSummary(signals) {
|
|
22590
23377
|
const lines = [];
|
|
22591
23378
|
const domains = ["life", "cyber", "joint"];
|
|
@@ -22611,7 +23398,7 @@ function formatEventSample(events, maxEvents) {
|
|
|
22611
23398
|
"${content}"`;
|
|
22612
23399
|
}).join("\n");
|
|
22613
23400
|
}
|
|
22614
|
-
function parseInterpretation(raw, canonicalNames) {
|
|
23401
|
+
function parseInterpretation(raw, canonicalNames, vocabulary) {
|
|
22615
23402
|
let meaning = "";
|
|
22616
23403
|
let move = "";
|
|
22617
23404
|
let patternsArray = [];
|
|
@@ -22641,14 +23428,23 @@ function parseInterpretation(raw, canonicalNames) {
|
|
|
22641
23428
|
const patterns = [];
|
|
22642
23429
|
for (const item of patternsArray) {
|
|
22643
23430
|
if (!isPatternLike(item)) continue;
|
|
22644
|
-
const
|
|
23431
|
+
const rawName = String(item.name ?? "unnamed");
|
|
23432
|
+
const description = String(item.description ?? "");
|
|
22645
23433
|
const ev = item.evidence;
|
|
22646
|
-
|
|
23434
|
+
let name = rawName;
|
|
23435
|
+
let isCanonical = item.type === "canonical" || canonicalSet.has(rawName.toLowerCase());
|
|
23436
|
+
if (!isCanonical && vocabulary) {
|
|
23437
|
+
const matched = matchDeclaredPattern(rawName, description, vocabulary);
|
|
23438
|
+
if (matched) {
|
|
23439
|
+
name = matched.name;
|
|
23440
|
+
isCanonical = true;
|
|
23441
|
+
}
|
|
23442
|
+
}
|
|
22647
23443
|
patterns.push({
|
|
22648
|
-
name
|
|
23444
|
+
name,
|
|
22649
23445
|
type: isCanonical ? "canonical" : "candidate",
|
|
22650
|
-
declaredAs: isCanonical ?
|
|
22651
|
-
description
|
|
23446
|
+
declaredAs: isCanonical ? name : void 0,
|
|
23447
|
+
description,
|
|
22652
23448
|
evidence: {
|
|
22653
23449
|
signals: Array.isArray(ev?.signals) ? ev.signals.map(String) : [],
|
|
22654
23450
|
events: Array.isArray(ev?.events) ? ev.events.map(String) : [],
|
|
@@ -22666,6 +23462,7 @@ var init_patterns = __esm({
|
|
|
22666
23462
|
"src/radiant/core/patterns.ts"() {
|
|
22667
23463
|
"use strict";
|
|
22668
23464
|
init_compress();
|
|
23465
|
+
init_vocabulary();
|
|
22669
23466
|
}
|
|
22670
23467
|
});
|
|
22671
23468
|
|
|
@@ -22984,10 +23781,24 @@ Compare stated intent against actual GitHub activity. Gaps = drift.`;
|
|
|
22984
23781
|
} catch {
|
|
22985
23782
|
}
|
|
22986
23783
|
}
|
|
23784
|
+
const linearKey = process.env.LINEAR_API_KEY;
|
|
23785
|
+
if (linearKey) {
|
|
23786
|
+
try {
|
|
23787
|
+
const linear = await fetchLinearActivity(linearKey, { windowDays });
|
|
23788
|
+
events.push(...linear.events);
|
|
23789
|
+
adapterSignals += "\n\n" + formatLinearSignalsForPrompt(linear.signals);
|
|
23790
|
+
activeAdapters.push("linear");
|
|
23791
|
+
} catch {
|
|
23792
|
+
}
|
|
23793
|
+
}
|
|
22987
23794
|
events.sort((a, b) => Date.parse(a.timestamp) - Date.parse(b.timestamp));
|
|
23795
|
+
if (input.personalUser) {
|
|
23796
|
+
events = filterEventsByUser(events, input.personalUser);
|
|
23797
|
+
}
|
|
22988
23798
|
const classified = classifyEvents(events);
|
|
22989
23799
|
const signals = extractSignals(classified);
|
|
22990
23800
|
const scores = computeScores(signals, input.worldmodelContent !== "");
|
|
23801
|
+
const declaredVocabulary = extractDeclaredVocabulary(worldmodelContent);
|
|
22991
23802
|
const { patterns, meaning, move } = await interpretPatterns({
|
|
22992
23803
|
signals,
|
|
22993
23804
|
events: classified,
|
|
@@ -22995,6 +23806,7 @@ Compare stated intent against actual GitHub activity. Gaps = drift.`;
|
|
|
22995
23806
|
lens,
|
|
22996
23807
|
ai: input.ai,
|
|
22997
23808
|
canonicalPatterns: input.canonicalPatterns,
|
|
23809
|
+
declaredVocabulary,
|
|
22998
23810
|
statedIntent: [statedIntent, adapterSignals, priorReadContext].filter(Boolean).join("\n\n") || void 0
|
|
22999
23811
|
});
|
|
23000
23812
|
const rewrittenPatterns = patterns.map((p) => lens.rewrite(p));
|
|
@@ -23049,6 +23861,10 @@ Compare stated intent against actual GitHub activity. Gaps = drift.`;
|
|
|
23049
23861
|
worldStack
|
|
23050
23862
|
};
|
|
23051
23863
|
}
|
|
23864
|
+
function filterEventsByUser(events, username) {
|
|
23865
|
+
const target = username.toLowerCase();
|
|
23866
|
+
return events.filter((e) => e.actor.id.toLowerCase() === target);
|
|
23867
|
+
}
|
|
23052
23868
|
function computeScores(signals, worldmodelLoaded) {
|
|
23053
23869
|
const gate = DEFAULT_EVIDENCE_GATE;
|
|
23054
23870
|
const lifeSignals = signals.filter((s) => s.domain === "life");
|
|
@@ -23104,12 +23920,14 @@ var init_emergent = __esm({
|
|
|
23104
23920
|
init_discord();
|
|
23105
23921
|
init_slack();
|
|
23106
23922
|
init_notion();
|
|
23923
|
+
init_linear();
|
|
23107
23924
|
init_discovery();
|
|
23108
23925
|
init_exocortex();
|
|
23109
23926
|
init_palace();
|
|
23110
23927
|
init_compress();
|
|
23111
23928
|
init_governance();
|
|
23112
23929
|
init_signals();
|
|
23930
|
+
init_vocabulary();
|
|
23113
23931
|
init_math();
|
|
23114
23932
|
init_patterns();
|
|
23115
23933
|
init_renderer();
|
|
@@ -23164,22 +23982,22 @@ __export(server_exports, {
|
|
|
23164
23982
|
startRadiantMcp: () => startRadiantMcp
|
|
23165
23983
|
});
|
|
23166
23984
|
function loadWorldmodelContent(worldsPath) {
|
|
23167
|
-
const resolved = (0,
|
|
23168
|
-
if (!(0,
|
|
23985
|
+
const resolved = (0, import_path19.resolve)(worldsPath);
|
|
23986
|
+
if (!(0, import_fs18.existsSync)(resolved)) {
|
|
23169
23987
|
throw new Error(`Worlds path not found: ${resolved}`);
|
|
23170
23988
|
}
|
|
23171
|
-
const stat = (0,
|
|
23989
|
+
const stat = (0, import_fs18.statSync)(resolved);
|
|
23172
23990
|
if (stat.isFile()) {
|
|
23173
|
-
return (0,
|
|
23991
|
+
return (0, import_fs18.readFileSync)(resolved, "utf-8");
|
|
23174
23992
|
}
|
|
23175
23993
|
if (stat.isDirectory()) {
|
|
23176
|
-
const files = (0,
|
|
23177
|
-
(f) => (0,
|
|
23994
|
+
const files = (0, import_fs18.readdirSync)(resolved).filter(
|
|
23995
|
+
(f) => (0, import_path19.extname)(f) === ".md" && (f.endsWith(".worldmodel.md") || f.endsWith(".nv-world.md"))
|
|
23178
23996
|
).sort();
|
|
23179
23997
|
if (files.length === 0) {
|
|
23180
23998
|
throw new Error(`No worldmodel files found in ${resolved}`);
|
|
23181
23999
|
}
|
|
23182
|
-
return files.map((f) => (0,
|
|
24000
|
+
return files.map((f) => (0, import_fs18.readFileSync)((0, import_path19.join)(resolved, f), "utf-8")).join("\n\n---\n\n");
|
|
23183
24001
|
}
|
|
23184
24002
|
throw new Error(`Worlds path is neither a file nor directory: ${resolved}`);
|
|
23185
24003
|
}
|
|
@@ -23198,12 +24016,12 @@ async function startRadiantMcp(args) {
|
|
|
23198
24016
|
const server = new RadiantMcpServer({ worldsPath, lensId, model });
|
|
23199
24017
|
await server.start();
|
|
23200
24018
|
}
|
|
23201
|
-
var
|
|
24019
|
+
var import_fs18, import_path19, TOOLS, RadiantMcpServer;
|
|
23202
24020
|
var init_server = __esm({
|
|
23203
24021
|
"src/radiant/mcp/server.ts"() {
|
|
23204
24022
|
"use strict";
|
|
23205
|
-
|
|
23206
|
-
|
|
24023
|
+
import_fs18 = require("fs");
|
|
24024
|
+
import_path19 = require("path");
|
|
23207
24025
|
init_think();
|
|
23208
24026
|
init_emergent();
|
|
23209
24027
|
init_ai();
|
|
@@ -23431,7 +24249,9 @@ var init_server = __esm({
|
|
|
23431
24249
|
// src/cli/radiant.ts
|
|
23432
24250
|
var radiant_exports = {};
|
|
23433
24251
|
__export(radiant_exports, {
|
|
23434
|
-
|
|
24252
|
+
checkScopeConsent: () => checkScopeConsent,
|
|
24253
|
+
main: () => main34,
|
|
24254
|
+
parseArgs: () => parseArgs27
|
|
23435
24255
|
});
|
|
23436
24256
|
function parseArgs27(argv) {
|
|
23437
24257
|
const result = {
|
|
@@ -23443,8 +24263,12 @@ function parseArgs27(argv) {
|
|
|
23443
24263
|
exocortex: void 0,
|
|
23444
24264
|
teamExocortex: void 0,
|
|
23445
24265
|
view: void 0,
|
|
24266
|
+
user: void 0,
|
|
24267
|
+
personal: false,
|
|
24268
|
+
entireOrg: false,
|
|
23446
24269
|
json: false,
|
|
23447
24270
|
help: false,
|
|
24271
|
+
force: false,
|
|
23448
24272
|
rest: []
|
|
23449
24273
|
};
|
|
23450
24274
|
let i = 0;
|
|
@@ -23476,9 +24300,22 @@ function parseArgs27(argv) {
|
|
|
23476
24300
|
case "--view":
|
|
23477
24301
|
result.view = argv[++i];
|
|
23478
24302
|
break;
|
|
24303
|
+
case "--user":
|
|
24304
|
+
result.user = argv[++i];
|
|
24305
|
+
break;
|
|
24306
|
+
case "--personal":
|
|
24307
|
+
result.personal = true;
|
|
24308
|
+
break;
|
|
24309
|
+
case "--entire-org":
|
|
24310
|
+
result.entireOrg = true;
|
|
24311
|
+
break;
|
|
23479
24312
|
case "--json":
|
|
23480
24313
|
result.json = true;
|
|
23481
24314
|
break;
|
|
24315
|
+
case "--force":
|
|
24316
|
+
case "-f":
|
|
24317
|
+
result.force = true;
|
|
24318
|
+
break;
|
|
23482
24319
|
case "--help":
|
|
23483
24320
|
case "-h":
|
|
23484
24321
|
result.help = true;
|
|
@@ -23492,17 +24329,17 @@ function parseArgs27(argv) {
|
|
|
23492
24329
|
return result;
|
|
23493
24330
|
}
|
|
23494
24331
|
function loadWorldmodelContent2(worldsPath) {
|
|
23495
|
-
const resolved = (0,
|
|
23496
|
-
if (!(0,
|
|
24332
|
+
const resolved = (0, import_path20.resolve)(worldsPath);
|
|
24333
|
+
if (!(0, import_fs19.existsSync)(resolved)) {
|
|
23497
24334
|
throw new Error(`Worlds path not found: ${resolved}`);
|
|
23498
24335
|
}
|
|
23499
|
-
const stat = (0,
|
|
24336
|
+
const stat = (0, import_fs19.statSync)(resolved);
|
|
23500
24337
|
if (stat.isFile()) {
|
|
23501
|
-
return (0,
|
|
24338
|
+
return (0, import_fs19.readFileSync)(resolved, "utf-8");
|
|
23502
24339
|
}
|
|
23503
24340
|
if (stat.isDirectory()) {
|
|
23504
|
-
const files = (0,
|
|
23505
|
-
(f) => (0,
|
|
24341
|
+
const files = (0, import_fs19.readdirSync)(resolved).filter(
|
|
24342
|
+
(f) => (0, import_path20.extname)(f) === ".md" && (f.endsWith(".worldmodel.md") || f.endsWith(".nv-world.md"))
|
|
23506
24343
|
).sort();
|
|
23507
24344
|
if (files.length === 0) {
|
|
23508
24345
|
throw new Error(
|
|
@@ -23510,27 +24347,55 @@ function loadWorldmodelContent2(worldsPath) {
|
|
|
23510
24347
|
);
|
|
23511
24348
|
}
|
|
23512
24349
|
return files.map((f) => {
|
|
23513
|
-
const content = (0,
|
|
24350
|
+
const content = (0, import_fs19.readFileSync)((0, import_path20.join)(resolved, f), "utf-8");
|
|
23514
24351
|
return `<!-- worldmodel: ${f} -->
|
|
23515
24352
|
${content}`;
|
|
23516
24353
|
}).join("\n\n---\n\n");
|
|
23517
24354
|
}
|
|
23518
24355
|
throw new Error(`Worlds path is neither a file nor a directory: ${resolved}`);
|
|
23519
24356
|
}
|
|
23520
|
-
|
|
23521
|
-
|
|
23522
|
-
|
|
24357
|
+
function resolveWorldmodelContent(explicitPath, scopeOwner) {
|
|
24358
|
+
if (explicitPath) {
|
|
24359
|
+
return loadWorldmodelContent2(explicitPath);
|
|
24360
|
+
}
|
|
24361
|
+
const stack = discoverWorlds({
|
|
24362
|
+
repoDir: process.cwd(),
|
|
24363
|
+
scopeOwner
|
|
24364
|
+
});
|
|
24365
|
+
if (stack.worlds.length === 0) {
|
|
24366
|
+
const scopeLine = scopeOwner ? ` 3. github:${scopeOwner}/worlds (from scope arg)
|
|
24367
|
+
` : "";
|
|
24368
|
+
const ext = scopeOwner ? 4 : 3;
|
|
24369
|
+
const repo = scopeOwner ? 5 : 4;
|
|
23523
24370
|
process.stderr.write(
|
|
23524
|
-
`${RED2}Error:${RESET3}
|
|
23525
|
-
${DIM3}
|
|
24371
|
+
`${RED2}Error:${RESET3} No worldmodel found.
|
|
24372
|
+
${DIM3}Tried (in order):
|
|
24373
|
+
1. ~/.neuroverse/worlds/ (user tier)
|
|
24374
|
+
2. github:<owner>/worlds (org auto-detect from git remote)
|
|
24375
|
+
` + scopeLine + ` ${ext}. .neuroverse/config.json extends (explicit shared worlds)
|
|
24376
|
+
${repo}. ./worlds/ or ./.neuroverse/worlds/ (repo tier)
|
|
24377
|
+
|
|
24378
|
+
Pass --worlds <dir> or set RADIANT_WORLDS to specify explicitly.
|
|
24379
|
+
Or run against a <scope>/ where github.com/<scope>/worlds exists.${RESET3}
|
|
23526
24380
|
`
|
|
23527
24381
|
);
|
|
23528
24382
|
process.exit(1);
|
|
23529
24383
|
}
|
|
23530
|
-
|
|
23531
|
-
|
|
24384
|
+
process.stderr.write(`${DIM3}${formatActiveWorlds(stack)}${RESET3}
|
|
24385
|
+
|
|
24386
|
+
`);
|
|
24387
|
+
for (const warning of stack.warnings) {
|
|
24388
|
+
process.stderr.write(`${YELLOW3}\u26A0${RESET3} ${warning}
|
|
24389
|
+
`);
|
|
24390
|
+
}
|
|
24391
|
+
return stack.combinedContent;
|
|
24392
|
+
}
|
|
24393
|
+
async function cmdThink(args) {
|
|
24394
|
+
const lensId = args.lens ?? process.env.RADIANT_LENS;
|
|
24395
|
+
if (!lensId) {
|
|
23532
24396
|
process.stderr.write(
|
|
23533
|
-
`${RED2}Error:${RESET3} --
|
|
24397
|
+
`${RED2}Error:${RESET3} --lens <id> or RADIANT_LENS required.
|
|
24398
|
+
${DIM3}Available lenses: ${listLenses().join(", ")}${RESET3}
|
|
23534
24399
|
`
|
|
23535
24400
|
);
|
|
23536
24401
|
process.exit(1);
|
|
@@ -23549,7 +24414,7 @@ ${DIM3}Set it to your Anthropic API key to use Radiant's AI features.${RESET3}
|
|
|
23549
24414
|
query = args.rest.join(" ");
|
|
23550
24415
|
}
|
|
23551
24416
|
if (!query && !process.stdin.isTTY) {
|
|
23552
|
-
query = (0,
|
|
24417
|
+
query = (0, import_fs19.readFileSync)(0, "utf-8").trim();
|
|
23553
24418
|
}
|
|
23554
24419
|
if (!query) {
|
|
23555
24420
|
process.stderr.write(
|
|
@@ -23559,12 +24424,12 @@ ${DIM3}Use --query "...", pass as trailing args, or pipe via stdin.${RESET3}
|
|
|
23559
24424
|
);
|
|
23560
24425
|
process.exit(1);
|
|
23561
24426
|
}
|
|
23562
|
-
const
|
|
24427
|
+
const explicitWorldsPath = args.worlds ?? process.env.RADIANT_WORLDS;
|
|
24428
|
+
const worldmodelContent = resolveWorldmodelContent(explicitWorldsPath);
|
|
23563
24429
|
const model = args.model ?? process.env.RADIANT_MODEL;
|
|
23564
24430
|
const ai = createAnthropicAI(apiKey, model || void 0);
|
|
23565
24431
|
process.stderr.write(
|
|
23566
|
-
`${DIM3}
|
|
23567
|
-
${DIM3}Lens: ${lensId}${RESET3}
|
|
24432
|
+
`${DIM3}Lens: ${lensId}${RESET3}
|
|
23568
24433
|
${DIM3}Model: ${model ?? "claude-sonnet-4-20250514 (default)"}${RESET3}
|
|
23569
24434
|
|
|
23570
24435
|
`
|
|
@@ -23608,6 +24473,15 @@ ${DIM3}Model: ${model ?? "claude-sonnet-4-20250514 (default)"}${RESET3}
|
|
|
23608
24473
|
process.exit(2);
|
|
23609
24474
|
}
|
|
23610
24475
|
}
|
|
24476
|
+
function checkScopeConsent(input) {
|
|
24477
|
+
if (input.personal && !input.resolvedUser) {
|
|
24478
|
+
return { ok: false, reason: "personal_requires_user" };
|
|
24479
|
+
}
|
|
24480
|
+
if (input.scope.type === "org" && !input.entireOrg && !input.personal) {
|
|
24481
|
+
return { ok: false, reason: "org_requires_opt_in" };
|
|
24482
|
+
}
|
|
24483
|
+
return { ok: true };
|
|
24484
|
+
}
|
|
23611
24485
|
async function cmdEmergent(args) {
|
|
23612
24486
|
const scopeStr = args.rest[0];
|
|
23613
24487
|
if (!scopeStr) {
|
|
@@ -23618,19 +24492,48 @@ async function cmdEmergent(args) {
|
|
|
23618
24492
|
process.exit(1);
|
|
23619
24493
|
}
|
|
23620
24494
|
const scope = parseScope(scopeStr);
|
|
24495
|
+
const personalUser = args.user ?? process.env.RADIANT_USER;
|
|
24496
|
+
const consent = checkScopeConsent({
|
|
24497
|
+
scope,
|
|
24498
|
+
personal: args.personal,
|
|
24499
|
+
entireOrg: args.entireOrg,
|
|
24500
|
+
resolvedUser: personalUser
|
|
24501
|
+
});
|
|
24502
|
+
if (!consent.ok) {
|
|
24503
|
+
if (consent.reason === "personal_requires_user") {
|
|
24504
|
+
process.stderr.write(
|
|
24505
|
+
`${RED2}Error:${RESET3} --personal requires a GitHub username.
|
|
24506
|
+
${DIM3}Pass --user <login> or set RADIANT_USER. Radiant will read
|
|
24507
|
+
only that user's activity \u2014 no one else is observed.${RESET3}
|
|
24508
|
+
`
|
|
24509
|
+
);
|
|
24510
|
+
} else {
|
|
24511
|
+
process.stderr.write(
|
|
24512
|
+
`${YELLOW3}\u26A0${RESET3} ${BOLD3}"${scope.owner}" is an org-wide scope.${RESET3}
|
|
24513
|
+
|
|
24514
|
+
${DIM3}This reads activity across ALL repos in the org \u2014 a global-observer
|
|
24515
|
+
pattern that some teams consider offside with decentralization and
|
|
24516
|
+
cognitive-liberty principles. It's opt-in for that reason.${RESET3}
|
|
24517
|
+
|
|
24518
|
+
Three ways forward:
|
|
24519
|
+
${GREEN3}1.${RESET3} Scope to a single repo (recommended default):
|
|
24520
|
+
radiant emergent ${scope.owner}/<repo>
|
|
24521
|
+
|
|
24522
|
+
${GREEN3}2.${RESET3} Read only your own activity (personal mode):
|
|
24523
|
+
radiant emergent ${scope.owner}/ --personal --user <your-login>
|
|
24524
|
+
|
|
24525
|
+
${GREEN3}3.${RESET3} Explicitly opt in to org-wide observation:
|
|
24526
|
+
radiant emergent ${scope.owner}/ --entire-org
|
|
24527
|
+
`
|
|
24528
|
+
);
|
|
24529
|
+
}
|
|
24530
|
+
process.exit(1);
|
|
24531
|
+
}
|
|
23621
24532
|
const lensId = args.lens ?? process.env.RADIANT_LENS;
|
|
23622
24533
|
if (!lensId) {
|
|
23623
24534
|
process.stderr.write(
|
|
23624
24535
|
`${RED2}Error:${RESET3} --lens <id> or RADIANT_LENS required.
|
|
23625
24536
|
${DIM3}Available lenses: ${listLenses().join(", ")}${RESET3}
|
|
23626
|
-
`
|
|
23627
|
-
);
|
|
23628
|
-
process.exit(1);
|
|
23629
|
-
}
|
|
23630
|
-
const worldsPath = args.worlds ?? process.env.RADIANT_WORLDS;
|
|
23631
|
-
if (!worldsPath) {
|
|
23632
|
-
process.stderr.write(
|
|
23633
|
-
`${RED2}Error:${RESET3} --worlds <dir> or RADIANT_WORLDS required.
|
|
23634
24537
|
`
|
|
23635
24538
|
);
|
|
23636
24539
|
process.exit(1);
|
|
@@ -23652,7 +24555,11 @@ ${DIM3}Set it to a GitHub PAT with repo read access.${RESET3}
|
|
|
23652
24555
|
);
|
|
23653
24556
|
process.exit(1);
|
|
23654
24557
|
}
|
|
23655
|
-
const
|
|
24558
|
+
const explicitWorldsPath = args.worlds ?? process.env.RADIANT_WORLDS;
|
|
24559
|
+
const worldmodelContent = resolveWorldmodelContent(
|
|
24560
|
+
explicitWorldsPath,
|
|
24561
|
+
scope.owner
|
|
24562
|
+
);
|
|
23656
24563
|
const model = args.model ?? process.env.RADIANT_MODEL;
|
|
23657
24564
|
const ai = createAnthropicAI(anthropicKey, model || void 0);
|
|
23658
24565
|
const view = args.view ?? process.env.RADIANT_VIEW ?? "community";
|
|
@@ -23670,8 +24577,11 @@ ${DIM3}Set it to a GitHub PAT with repo read access.${RESET3}
|
|
|
23670
24577
|
const ctx = readExocortex(exocortexPath);
|
|
23671
24578
|
exocortexStatus = summarizeExocortex(ctx);
|
|
23672
24579
|
}
|
|
24580
|
+
const scopeLabel = scope.type === "org" ? scope.owner + " (entire org)" : scope.owner + "/" + scope.repo;
|
|
24581
|
+
const modeLabel = args.personal ? `personal \u2014 only ${personalUser}'s activity` : "team \u2014 all contributors";
|
|
23673
24582
|
process.stderr.write(
|
|
23674
|
-
`${DIM3}Scope: ${
|
|
24583
|
+
`${DIM3}Scope: ${scopeLabel}${RESET3}
|
|
24584
|
+
${DIM3}Mode: ${modeLabel}${RESET3}
|
|
23675
24585
|
${DIM3}View: ${view}${RESET3}
|
|
23676
24586
|
${DIM3}Lens: ${lensId}${RESET3}
|
|
23677
24587
|
${DIM3}Model: ${model ?? "claude-sonnet-4-20250514 (default)"}${RESET3}
|
|
@@ -23687,7 +24597,8 @@ ${DIM3}Fetching activity...${RESET3}
|
|
|
23687
24597
|
lensId,
|
|
23688
24598
|
ai,
|
|
23689
24599
|
windowDays: 14,
|
|
23690
|
-
exocortexPath: exocortexPath || void 0
|
|
24600
|
+
exocortexPath: exocortexPath || void 0,
|
|
24601
|
+
personalUser: args.personal ? personalUser : void 0
|
|
23691
24602
|
});
|
|
23692
24603
|
if (!result.voiceClean) {
|
|
23693
24604
|
process.stderr.write(
|
|
@@ -23789,6 +24700,43 @@ ${DIM3}Use: lenses list | lenses describe <id>${RESET3}
|
|
|
23789
24700
|
);
|
|
23790
24701
|
process.exit(1);
|
|
23791
24702
|
}
|
|
24703
|
+
async function cmdInit2(args) {
|
|
24704
|
+
const targetDir = (0, import_path20.resolve)(args.rest[0] ?? "./mind-palace");
|
|
24705
|
+
const existed = (0, import_fs19.existsSync)(targetDir);
|
|
24706
|
+
if (existed && !args.force) {
|
|
24707
|
+
const entries = (0, import_fs19.readdirSync)(targetDir);
|
|
24708
|
+
if (entries.length > 0) {
|
|
24709
|
+
process.stderr.write(
|
|
24710
|
+
`${RED2}Error:${RESET3} ${targetDir} already exists and is not empty.
|
|
24711
|
+
${DIM3}Use --force to write into it anyway (existing files will be overwritten).${RESET3}
|
|
24712
|
+
`
|
|
24713
|
+
);
|
|
24714
|
+
process.exit(1);
|
|
24715
|
+
}
|
|
24716
|
+
}
|
|
24717
|
+
(0, import_fs19.mkdirSync)(targetDir, { recursive: true });
|
|
24718
|
+
(0, import_fs19.mkdirSync)((0, import_path20.join)(targetDir, "reads"), { recursive: true });
|
|
24719
|
+
(0, import_fs19.mkdirSync)((0, import_path20.join)(targetDir, "worldmodels"), { recursive: true });
|
|
24720
|
+
for (const [relPath, content] of Object.entries(MIND_PALACE_FILES)) {
|
|
24721
|
+
const fullPath = (0, import_path20.join)(targetDir, relPath);
|
|
24722
|
+
(0, import_fs19.mkdirSync)((0, import_path20.resolve)(fullPath, ".."), { recursive: true });
|
|
24723
|
+
(0, import_fs19.writeFileSync)(fullPath, content, "utf-8");
|
|
24724
|
+
}
|
|
24725
|
+
process.stdout.write(
|
|
24726
|
+
`${GREEN3}\u2713${RESET3} Mind Palace scaffolded at ${BOLD3}${targetDir}${RESET3}
|
|
24727
|
+
|
|
24728
|
+
${DIM3}Next steps:${RESET3}
|
|
24729
|
+
1. Edit ${targetDir}/attention.md \u2014 what you're focused on right now
|
|
24730
|
+
2. Edit ${targetDir}/worldmodels/starter.worldmodel.md \u2014 add a few
|
|
24731
|
+
aligned and drift behaviors
|
|
24732
|
+
3. Run: neuroverse radiant emergent <owner/repo> \\
|
|
24733
|
+
--worlds ${targetDir}/worldmodels \\
|
|
24734
|
+
--exocortex ${targetDir}
|
|
24735
|
+
|
|
24736
|
+
${DIM3}Files are yours. Edit freely.${RESET3}
|
|
24737
|
+
`
|
|
24738
|
+
);
|
|
24739
|
+
}
|
|
23792
24740
|
async function main34(argv) {
|
|
23793
24741
|
const args = parseArgs27(argv);
|
|
23794
24742
|
if (args.help || !args.subcommand) {
|
|
@@ -23796,6 +24744,8 @@ async function main34(argv) {
|
|
|
23796
24744
|
return;
|
|
23797
24745
|
}
|
|
23798
24746
|
switch (args.subcommand) {
|
|
24747
|
+
case "init":
|
|
24748
|
+
return cmdInit2(args);
|
|
23799
24749
|
case "think":
|
|
23800
24750
|
return cmdThink(args);
|
|
23801
24751
|
case "lenses":
|
|
@@ -23826,19 +24776,21 @@ async function main34(argv) {
|
|
|
23826
24776
|
process.exit(1);
|
|
23827
24777
|
}
|
|
23828
24778
|
}
|
|
23829
|
-
var
|
|
24779
|
+
var import_fs19, import_path20, RED2, GREEN3, DIM3, BOLD3, YELLOW3, RESET3, USAGE10, MIND_PALACE_FILES;
|
|
23830
24780
|
var init_radiant = __esm({
|
|
23831
24781
|
"src/cli/radiant.ts"() {
|
|
23832
24782
|
"use strict";
|
|
23833
|
-
|
|
23834
|
-
|
|
24783
|
+
import_fs19 = require("fs");
|
|
24784
|
+
import_path20 = require("path");
|
|
23835
24785
|
init_think();
|
|
23836
24786
|
init_emergent();
|
|
23837
24787
|
init_ai();
|
|
23838
24788
|
init_scopes();
|
|
23839
24789
|
init_exocortex();
|
|
23840
24790
|
init_lenses();
|
|
24791
|
+
init_discovery();
|
|
23841
24792
|
RED2 = "\x1B[31m";
|
|
24793
|
+
GREEN3 = "\x1B[32m";
|
|
23842
24794
|
DIM3 = "\x1B[2m";
|
|
23843
24795
|
BOLD3 = "\x1B[1m";
|
|
23844
24796
|
YELLOW3 = "\x1B[33m";
|
|
@@ -23846,6 +24798,9 @@ var init_radiant = __esm({
|
|
|
23846
24798
|
USAGE10 = `
|
|
23847
24799
|
${BOLD3}neuroverse radiant${RESET3} \u2014 behavioral intelligence for collaboration systems
|
|
23848
24800
|
|
|
24801
|
+
${BOLD3}Setup:${RESET3}
|
|
24802
|
+
init Scaffold a Mind Palace in the current directory
|
|
24803
|
+
|
|
23849
24804
|
${BOLD3}Stage A (voice layer):${RESET3}
|
|
23850
24805
|
think Send a query through the worldmodel + lens \u2192 AI-framed response
|
|
23851
24806
|
|
|
@@ -23856,20 +24811,208 @@ ${BOLD3}Stage B (behavioral analysis, coming soon):${RESET3}
|
|
|
23856
24811
|
lenses List or describe available rendering lenses
|
|
23857
24812
|
|
|
23858
24813
|
${BOLD3}Usage:${RESET3}
|
|
24814
|
+
neuroverse radiant init (scaffolds ./mind-palace/)
|
|
24815
|
+
neuroverse radiant init ./my-palace (custom path)
|
|
23859
24816
|
neuroverse radiant think --lens auki-builder --worlds ./worlds/ --query "What is our biggest risk?"
|
|
23860
24817
|
neuroverse radiant think --lens auki-builder --worlds ./worlds/ < prompt.txt
|
|
23861
24818
|
neuroverse radiant emergent aukiverse/posemesh --lens auki-builder --worlds ./worlds/
|
|
23862
24819
|
neuroverse radiant emergent aukiverse/posemesh --lens auki-builder --worlds ./worlds/ --exocortex ~/exocortex/
|
|
24820
|
+
neuroverse radiant emergent aukilabs/posemesh --personal --user alice
|
|
24821
|
+
neuroverse radiant emergent aukilabs/ --entire-org --lens auki-builder --worlds ./worlds/
|
|
23863
24822
|
neuroverse radiant lenses list
|
|
23864
24823
|
neuroverse radiant lenses describe auki-builder
|
|
23865
24824
|
|
|
24825
|
+
${BOLD3}Read modes:${RESET3}
|
|
24826
|
+
${BOLD3}Default (team):${RESET3} reads all contributors in the given scope.
|
|
24827
|
+
${BOLD3}--personal --user <login>:${RESET3} reads ONLY that user's activity.
|
|
24828
|
+
A local, private facilitator \u2014 no one else is observed. Works against
|
|
24829
|
+
any scope; an org scope with --personal is fine.
|
|
24830
|
+
${BOLD3}--entire-org (gated):${RESET3} org-wide scope observes every contributor
|
|
24831
|
+
across every repo. This is a global-observer stance and is opt-in.
|
|
24832
|
+
\`radiant emergent <org>/\` without --entire-org will refuse and show
|
|
24833
|
+
you the three choices (single repo, --personal, or explicit opt-in).
|
|
24834
|
+
|
|
24835
|
+
${BOLD3}Auto-discovery:${RESET3}
|
|
24836
|
+
You do not need to clone the target repo.
|
|
24837
|
+
|
|
24838
|
+
radiant emergent NeuroverseOS/ \u2192 probes github.com/NeuroverseOS/worlds
|
|
24839
|
+
radiant emergent aukiverse/posemesh \u2192 probes github.com/aukiverse/worlds
|
|
24840
|
+
|
|
24841
|
+
The scope argument itself is enough. Discovery also picks up
|
|
24842
|
+
~/.neuroverse/worlds/ (personal), the org from your current clone's
|
|
24843
|
+
.git/config (if any), and ./worlds/ (this repo).
|
|
24844
|
+
|
|
24845
|
+
Set NEUROVERSE_NO_ORG=1 to disable org probing for a single run.
|
|
24846
|
+
|
|
23866
24847
|
${BOLD3}Environment:${RESET3}
|
|
23867
24848
|
ANTHROPIC_API_KEY Required for AI commands (think, emergent, decision)
|
|
23868
24849
|
RADIANT_WORLDS Default worlds directory (overridden by --worlds)
|
|
23869
24850
|
RADIANT_LENS Default lens id (overridden by --lens)
|
|
23870
24851
|
RADIANT_MODEL AI model override (default: claude-sonnet-4-20250514)
|
|
23871
24852
|
RADIANT_EXOCORTEX Default exocortex directory (overridden by --exocortex)
|
|
24853
|
+
RADIANT_USER Default personal-mode user (overridden by --user)
|
|
23872
24854
|
`.trim();
|
|
24855
|
+
MIND_PALACE_FILES = {
|
|
24856
|
+
"README.md": `# Mind Palace
|
|
24857
|
+
|
|
24858
|
+
This is your Mind Palace \u2014 structured external memory that gives Radiant
|
|
24859
|
+
(and any agent you wire into it) persistent context about who you are,
|
|
24860
|
+
what you're working on, and what "on track" means for you.
|
|
24861
|
+
|
|
24862
|
+
Radiant reads these files before every run and writes each read back into
|
|
24863
|
+
\`reads/\`. Over time, \`knowledge.md\` accumulates what's persisted and what
|
|
24864
|
+
hasn't \u2014 the feedback loop that turns raw activity into named behavior.
|
|
24865
|
+
|
|
24866
|
+
## Files
|
|
24867
|
+
|
|
24868
|
+
- \`attention.md\` \u2014 what you're focused on **right now**
|
|
24869
|
+
- \`goals.md\` \u2014 what you're working toward
|
|
24870
|
+
- \`sprint.md\` \u2014 this week's focus
|
|
24871
|
+
- \`identity.md\` \u2014 who you are, what you value
|
|
24872
|
+
- \`worldmodels/\` \u2014 your thinking constitutions (drift + aligned behaviors)
|
|
24873
|
+
- \`reads/\` \u2014 dated Radiant reads (written by \`radiant emergent\`)
|
|
24874
|
+
- \`knowledge.md\` \u2014 accumulated pattern persistence across reads
|
|
24875
|
+
|
|
24876
|
+
## How to use
|
|
24877
|
+
|
|
24878
|
+
1. Fill in \`attention.md\`, \`goals.md\`, \`sprint.md\`, \`identity.md\` with
|
|
24879
|
+
your own words. A sentence each is enough to start \u2014 the files grow
|
|
24880
|
+
with you.
|
|
24881
|
+
2. Edit \`worldmodels/starter.worldmodel.md\`: add a few aligned behaviors
|
|
24882
|
+
(what on-track looks like) and drift behaviors (what off-track looks
|
|
24883
|
+
like). The sharper these are, the sharper Radiant's reads.
|
|
24884
|
+
3. Run \`neuroverse radiant emergent <owner/repo> --mind-palace .\` against
|
|
24885
|
+
the repo you want read. Radiant compares your stated intent (these
|
|
24886
|
+
files) to your observed activity (GitHub) and names the gap.
|
|
24887
|
+
|
|
24888
|
+
Edit freely. These files are yours.
|
|
24889
|
+
`,
|
|
24890
|
+
"attention.md": `# Attention
|
|
24891
|
+
|
|
24892
|
+
<!--
|
|
24893
|
+
What are you focused on RIGHT NOW? One paragraph. Updated as you shift.
|
|
24894
|
+
This is the file an AI agent reads at the start of a session to know
|
|
24895
|
+
what to help with today.
|
|
24896
|
+
-->
|
|
24897
|
+
|
|
24898
|
+
`,
|
|
24899
|
+
"goals.md": `# Goals
|
|
24900
|
+
|
|
24901
|
+
<!--
|
|
24902
|
+
What are you working toward? Bullet points welcome.
|
|
24903
|
+
Longer horizon than attention \u2014 months, not days.
|
|
24904
|
+
-->
|
|
24905
|
+
|
|
24906
|
+
-
|
|
24907
|
+
`,
|
|
24908
|
+
"sprint.md": `# Sprint
|
|
24909
|
+
|
|
24910
|
+
<!--
|
|
24911
|
+
This week's focus. What do you want to ship or finish?
|
|
24912
|
+
Keep it short \u2014 five bullets max.
|
|
24913
|
+
-->
|
|
24914
|
+
|
|
24915
|
+
-
|
|
24916
|
+
`,
|
|
24917
|
+
"identity.md": `# Identity
|
|
24918
|
+
|
|
24919
|
+
<!--
|
|
24920
|
+
Who are you, what do you value, how do you work?
|
|
24921
|
+
This is the context an agent needs to not treat you like a stranger
|
|
24922
|
+
every time. Write it in your own voice.
|
|
24923
|
+
-->
|
|
24924
|
+
|
|
24925
|
+
`,
|
|
24926
|
+
"knowledge.md": `# Knowledge
|
|
24927
|
+
|
|
24928
|
+
<!--
|
|
24929
|
+
Radiant writes accumulated pattern persistence here across reads.
|
|
24930
|
+
Leave this file empty on day one \u2014 it fills up as \`radiant emergent\`
|
|
24931
|
+
runs accumulate.
|
|
24932
|
+
-->
|
|
24933
|
+
|
|
24934
|
+
`,
|
|
24935
|
+
"reads/.gitkeep": "",
|
|
24936
|
+
"worldmodels/starter.worldmodel.md": `# Starter Worldmodel
|
|
24937
|
+
|
|
24938
|
+
<!--
|
|
24939
|
+
Your thinking constitution. Radiant reads this to understand what
|
|
24940
|
+
"aligned" and "drift" mean for your work.
|
|
24941
|
+
|
|
24942
|
+
The sharper the Aligned/Drift Behaviors, the sharper Radiant's reads.
|
|
24943
|
+
When Radiant detects something matching a drift behavior below, it
|
|
24944
|
+
labels it with THAT name \u2014 it doesn't invent new ones.
|
|
24945
|
+
-->
|
|
24946
|
+
|
|
24947
|
+
## Mission
|
|
24948
|
+
|
|
24949
|
+
<!-- One sentence. What are you doing in the world? -->
|
|
24950
|
+
|
|
24951
|
+
|
|
24952
|
+
## Invariants
|
|
24953
|
+
|
|
24954
|
+
<!--
|
|
24955
|
+
Non-negotiable rules. If a decision violates one, it's blocked.
|
|
24956
|
+
Keep this list short \u2014 3 to 6 items. Each should be a hard no.
|
|
24957
|
+
-->
|
|
24958
|
+
|
|
24959
|
+
-
|
|
24960
|
+
|
|
24961
|
+
## Aligned Behaviors
|
|
24962
|
+
|
|
24963
|
+
<!--
|
|
24964
|
+
What "on track" looks like. One per line, phrased as a behavior.
|
|
24965
|
+
Radiant will use these as canonical pattern names when it sees
|
|
24966
|
+
matching evidence in your activity.
|
|
24967
|
+
|
|
24968
|
+
Example:
|
|
24969
|
+
- ships partial-but-working features rather than waiting for the full stack
|
|
24970
|
+
- writes decisions down before acting on them
|
|
24971
|
+
-->
|
|
24972
|
+
|
|
24973
|
+
-
|
|
24974
|
+
|
|
24975
|
+
## Drift Behaviors
|
|
24976
|
+
|
|
24977
|
+
<!--
|
|
24978
|
+
What "off track" looks like. Same format as Aligned.
|
|
24979
|
+
When Radiant detects drift, it will label it with these names \u2014 not
|
|
24980
|
+
make up new ones.
|
|
24981
|
+
|
|
24982
|
+
Example:
|
|
24983
|
+
- shipping pace outruns strategic decision-making
|
|
24984
|
+
- architecture decisions surface without context about why
|
|
24985
|
+
-->
|
|
24986
|
+
|
|
24987
|
+
-
|
|
24988
|
+
|
|
24989
|
+
## Signals
|
|
24990
|
+
|
|
24991
|
+
<!--
|
|
24992
|
+
Observable quantities you care about. Radiant scores activity
|
|
24993
|
+
against these \u2014 5 to 7 is the sweet spot.
|
|
24994
|
+
|
|
24995
|
+
Example:
|
|
24996
|
+
- shipping_velocity
|
|
24997
|
+
- decision_ownership
|
|
24998
|
+
- storytelling_cadence
|
|
24999
|
+
-->
|
|
25000
|
+
|
|
25001
|
+
-
|
|
25002
|
+
|
|
25003
|
+
## Decision Priorities
|
|
25004
|
+
|
|
25005
|
+
<!--
|
|
25006
|
+
When tradeoffs appear, these resolve them. Format: "A > B".
|
|
25007
|
+
|
|
25008
|
+
Example:
|
|
25009
|
+
- correctness > speed
|
|
25010
|
+
- clarity > cleverness
|
|
25011
|
+
-->
|
|
25012
|
+
|
|
25013
|
+
-
|
|
25014
|
+
`
|
|
25015
|
+
};
|
|
23873
25016
|
}
|
|
23874
25017
|
});
|
|
23875
25018
|
|