babavoss 0.12.6 → 0.13.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/gui/babavoss-web.js +1 -1
- package/gui/{chunk-9gmmm54v.js → chunk-a20zfekq.js} +4 -2
- package/gui/gui.js +15 -15
- package/index.ts +1 -1
- package/package.json +5 -5
- package/src/{promptware → agents}/compile.ts +12 -12
- package/src/{promptware → agents}/define.ts +2 -2
- package/src/{promptware → agents}/disk.ts +7 -4
- package/src/{promptware → agents}/sync.ts +2 -2
- package/src/{promptware → agents}/system.ts +17 -17
- package/src/baba/check.ts +3 -3
- package/src/baba/config.ts +5 -2
- package/src/baba/init.ts +13 -18
- package/src/baba/node.ts +2 -2
- package/src/baba/worker.ts +13 -5
- package/src/build/mdx.ts +4 -4
- package/src/build/project.ts +6 -1
- package/src/build/views.ts +3 -3
- package/src/desktop/index.ts +1 -1
- package/src/door/core.ts +2 -2
- package/src/ecs/baba.ts +27 -17
- package/src/generated/build.ts +1 -1
- package/src/gui/gui.tsx +3 -3
- package/src/gui/{promptware.tsx → instructions.tsx} +12 -12
- package/src/gui/theme.css +1 -1
- package/src/guide/add-a-desktop.mdx +2 -2
- package/src/guide/index.ts +4 -4
- package/src/guide/write-a-system.mdx +3 -3
- package/src/guide/{write-promptware.mdx → write-agentic-instructions.mdx} +17 -24
- package/src/{prompt → instructions}/evals.ts +1 -1
- package/src/{prompt → instructions}/index.ts +9 -8
- package/src/{prompt → instructions}/jsx-runtime.ts +3 -3
- package/src/mcp/main.ts +3 -3
- package/src/mcp/tools.ts +4 -4
- package/src/runtime/harness.ts +2 -2
- package/src/shell/run.ts +18 -18
- package/src/spec/index.ts +1 -1
- package/src/web/core.tsx +2 -2
- /package/src/{promptware → agents}/markdown.d.ts +0 -0
- /package/src/{prompt → instructions}/jsx-dev-runtime.ts +0 -0
- /package/src/{prompt → instructions}/mdx.d.ts +0 -0
package/src/runtime/harness.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { manifestOf, type Baba } from "../ecs/baba.ts";
|
|
|
6
6
|
import { Runtime, ContractError } from "../ecs/runtime.ts";
|
|
7
7
|
import { StateError, type Snapshot } from "../ecs/state.ts";
|
|
8
8
|
import { makeBridge, portOver } from "./bridge.ts";
|
|
9
|
-
import {
|
|
9
|
+
import { withInstructions } from "../agents/system.ts";
|
|
10
10
|
|
|
11
11
|
/** How long a `state` read waits for the round past `since` before answering the state as it is. */
|
|
12
12
|
export const STATE_WAIT_MS = 25_000;
|
|
@@ -23,7 +23,7 @@ export class Harness {
|
|
|
23
23
|
/** Loads the baba over the snapshot given; answers `loaded`, or throws for `failed`. */
|
|
24
24
|
load(own: Baba, project: { name: string; dir: string; baba: string }, env: Record<string, string>, snapshot: Snapshot | null, prepare = false): void {
|
|
25
25
|
// Voss's own systems join every baba after its own.
|
|
26
|
-
const v =
|
|
26
|
+
const v = withInstructions(own);
|
|
27
27
|
const manifest = manifestOf(v);
|
|
28
28
|
const make = (snapshot: Snapshot | null, auto: boolean) => new Runtime(v, {
|
|
29
29
|
auto,
|
package/src/shell/run.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// voss baba follow ENTITY | COMPONENT KEY [--until C | C.field=value] [--for 30s] [--changes]
|
|
10
10
|
// voss baba follow QUERY [args…] --changed [--for 30s]
|
|
11
11
|
// voss baba run [FILE | LINE …] | raw spawn JSON | add E COMPONENT [JSON] | remove E COMPONENT … | despawn E | set RESOURCE JSON
|
|
12
|
-
// voss baba check | install | add-system NAME |
|
|
12
|
+
// voss baba check | install | add-system NAME | agents … | serve [HOST:PORT]
|
|
13
13
|
// voss init [DIR] | babas … | gui [HOST:PORT] | service …
|
|
14
14
|
//
|
|
15
15
|
// Stdout is one line of JSON per answer (`--pretty` indents it); stderr is
|
|
@@ -30,8 +30,8 @@ import { serve } from "../http/server.ts";
|
|
|
30
30
|
import { words, callArgs, usage, describeArgs, UsageError } from "./args.ts";
|
|
31
31
|
import { init, install, addSystem } from "../baba/init.ts";
|
|
32
32
|
import { check } from "../baba/check.ts";
|
|
33
|
-
import { planProject, syncProject, outputOf, sources } from "../
|
|
34
|
-
import { report } from "../
|
|
33
|
+
import { planProject, syncProject, outputOf, sources } from "../agents/disk.ts";
|
|
34
|
+
import { report } from "../agents/sync.ts";
|
|
35
35
|
import * as service from "./service.ts";
|
|
36
36
|
import { connect, daemon, type Client, type Daemon } from "./client.ts";
|
|
37
37
|
import { runMcp } from "../mcp/main.ts";
|
|
@@ -131,7 +131,7 @@ const builtinHelp: Record<string, string> = {
|
|
|
131
131
|
"add-system": "a system under .baba/systems/NAME: add-system NAME",
|
|
132
132
|
serve: "the GUI for this baba alone: serve [HOST:PORT]",
|
|
133
133
|
mcp: "an MCP server over stdio for agents, a client of the running voss",
|
|
134
|
-
|
|
134
|
+
agents: "the agentic instructions compiled: agents compile | sync | output PATH",
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
/**
|
|
@@ -177,7 +177,7 @@ function globals(argv: string[]): { ws: string[]; pretty: boolean; max: number }
|
|
|
177
177
|
|
|
178
178
|
export async function run(argv: string[], sh: Shell): Promise<number> {
|
|
179
179
|
const reg = new Registry(sh.rootDir);
|
|
180
|
-
// Every answer is JSON; the
|
|
180
|
+
// Every answer is JSON; the agentic instructions block below still reads this.
|
|
181
181
|
const json = true;
|
|
182
182
|
let callUsage: string | undefined;
|
|
183
183
|
let outDir: string | undefined;
|
|
@@ -304,7 +304,7 @@ export async function run(argv: string[], sh: Shell): Promise<number> {
|
|
|
304
304
|
}
|
|
305
305
|
if (name === "manifest") {
|
|
306
306
|
// The baba loaded once, in this process, and let go: what every load writes, .baba/.voss/manifest.json, is there
|
|
307
|
-
// for the index, --schema and the
|
|
307
|
+
// for the index, --schema and the agentic instructions before the baba ever runs under the daemon, as in a fresh worktree.
|
|
308
308
|
const lines: string[] = [];
|
|
309
309
|
const n = new Node(project, (l) => lines.push(l));
|
|
310
310
|
try { await n.start(); } finally { await n.stop(); }
|
|
@@ -345,36 +345,36 @@ export async function run(argv: string[], sh: Shell): Promise<number> {
|
|
|
345
345
|
const c = await connect(project, sh.rootDir, prog).catch(downOnly);
|
|
346
346
|
const down = c instanceof NodeError ? c : null;
|
|
347
347
|
const d = c instanceof NodeError ? null : await c.describe();
|
|
348
|
-
// Down, the
|
|
349
|
-
// go, as \`manifest\` does, so a fresh worktree has one and an edit to the
|
|
348
|
+
// Down, the agentic instructions compiles from a manifest of the code as it is now: the baba is loaded once in this process and let
|
|
349
|
+
// go, as \`manifest\` does, so a fresh worktree has one and an edit to the agentic instructions is in it. Busy or broken, the last one stands.
|
|
350
350
|
let loadError: string | null = null;
|
|
351
|
-
if (down && name === "
|
|
351
|
+
if (down && name === "agents") {
|
|
352
352
|
const n = new Node(project, () => {});
|
|
353
353
|
try { await n.start(); } catch (err) { loadError = err instanceof Error ? err.message : String(err); } finally { await n.stop().catch(() => {}); }
|
|
354
354
|
}
|
|
355
355
|
const m = d ? d.manifest : await readManifest(project);
|
|
356
356
|
if (!m && loadError) throw new ShellError("failed", `${project.name} did not load: ${loadError}`);
|
|
357
357
|
if (!m) { if (down) throw down; throw new ShellError("down", `${project.name} is not running${d?.error ? `: ${d.error}` : ""}`); }
|
|
358
|
-
if (name === "
|
|
359
|
-
// Running, the baba's
|
|
358
|
+
if (name === "agents") {
|
|
359
|
+
// Running, the baba's agents system syncs, and the answer waits for it; down, the same compiler runs here over the files.
|
|
360
360
|
const [cmd, path] = args;
|
|
361
|
-
if (cmd === "sync" && d && !d.error && "
|
|
361
|
+
if (cmd === "sync" && d && !d.error && "agents-sync" in m.actions) {
|
|
362
362
|
const live = c as Client;
|
|
363
|
-
const syncs = async () => await live.read("
|
|
363
|
+
const syncs = async () => await live.read("agents-plan", {}) as { syncs: number; error: string | null };
|
|
364
364
|
const before = (await syncs()).syncs;
|
|
365
|
-
await live.fire("
|
|
365
|
+
await live.fire("agents-sync", {});
|
|
366
366
|
for (let i = 0; i < 200; i++) {
|
|
367
367
|
const p = await syncs();
|
|
368
|
-
if (p.syncs > before) { if (p.error) return fail(`
|
|
368
|
+
if (p.syncs > before) { if (p.error) return fail(`agents sync: ${p.error}`); out(p); return 0; }
|
|
369
369
|
await new Promise((r) => setTimeout(r, 50));
|
|
370
370
|
}
|
|
371
|
-
return fail("
|
|
371
|
+
return fail("agents sync: asked, not finished within 10s; agents-plan says how it went");
|
|
372
372
|
}
|
|
373
373
|
const input = sources(project.dir, m, project.title);
|
|
374
374
|
if (cmd === "compile") { out(report(await planProject(project.dir, input))); return 0; }
|
|
375
375
|
if (cmd === "sync") { out(await syncProject(project.dir, input)); return 0; }
|
|
376
376
|
if (cmd === "output" && path) { const o = await outputOf(project.dir, input, path); out(json ? o : { path: o.path, status: o.status }); if (!json) sh.stdout(o.text); return 0; }
|
|
377
|
-
sh.stdout(`Usage: ${prog}
|
|
377
|
+
sh.stdout(`Usage: ${prog} agents compile | sync | output PATH\n`);
|
|
378
378
|
return help ? 0 : 2;
|
|
379
379
|
}
|
|
380
380
|
if (!name) {
|
|
@@ -462,7 +462,7 @@ function contract(prog: string, title: string, m: Manifest, error: string | null
|
|
|
462
462
|
section("Resources", Object.entries(m.resources).map(([n, r]) => [n, r.owner]));
|
|
463
463
|
section("Effects", Object.entries(m.effects).map(([n, e]) => [n, `${e.owner}${e.every ? ` · every ${e.every} ms` : ""}${e.retry ? ` · retry ${e.retry} ms` : ""}${e.summary ? ` · ${e.summary}` : ""}`]));
|
|
464
464
|
section("The state", Object.entries(builtinHelp).filter(([k]) => ["state", "follow", "run", "raw"].includes(k)).map(([k, h]) => [k, h]));
|
|
465
|
-
section("Voss", Object.entries(builtinHelp).filter(([k]) => ["start", "stop", "status", "mcp", "check", "manifest", "install", "add-system", "serve", "
|
|
465
|
+
section("Voss", Object.entries(builtinHelp).filter(([k]) => ["start", "stop", "status", "mcp", "check", "manifest", "install", "add-system", "serve", "agents"].includes(k)).map(([k, h]) => [k, h]));
|
|
466
466
|
lines.push(`State: ${where}${error ? ` · the last load failed: ${error}` : ""}`);
|
|
467
467
|
return lines.join("\n") + "\n";
|
|
468
468
|
}
|
package/src/spec/index.ts
CHANGED
|
@@ -91,7 +91,7 @@ export function spec(target: System | Baba, def: SpecDef<any, any> = {}): Spec<a
|
|
|
91
91
|
if (!NAME.test(name)) throw new Error(`spec ${JSON.stringify(name)}: lowercase words joined by single dashes`);
|
|
92
92
|
const base = whole ? (target as Baba) : baba({ systems: closureOf([target as System]) });
|
|
93
93
|
const tick = def.tick === undefined ? base.tick : def.tick;
|
|
94
|
-
const v = tick === base.tick ? base : baba({ systems: base.systems, ...(tick !== null ? { tick } : {}),
|
|
94
|
+
const v = tick === base.tick ? base : baba({ systems: base.systems, ...(tick !== null ? { tick } : {}), instructions: base.instructions, apps: base.apps });
|
|
95
95
|
const names = new Set<string>();
|
|
96
96
|
for (const sc of def.scenarios ?? []) { if (names.has(sc.name)) throw new Error(`spec ${name}: two scenarios are named ${JSON.stringify(sc.name)}`); names.add(sc.name); }
|
|
97
97
|
const also = def.also ?? [];
|
package/src/web/core.tsx
CHANGED
|
@@ -47,7 +47,7 @@ function routed(key: string, table: RouteTable): ComponentType<AppProps> {
|
|
|
47
47
|
* the baba declares in `baba({ apps })`, and none other; the keys are checked against them. An app that
|
|
48
48
|
* declares routes may be given a component per route instead, `{ "/": Prs, "/pr/:n": Pr }`, checked
|
|
49
49
|
* against its routes: every route, none other. One of voss's own apps, `maker`, `state`, `contract`,
|
|
50
|
-
* `
|
|
50
|
+
* `agentic instructions`, `settings`, may be given a component of the baba's to replace voss's.
|
|
51
51
|
* The old form, `compose({ shell })`, still loads.
|
|
52
52
|
*/
|
|
53
53
|
export function compose<V extends { $app: string }>(def: { apps: { [K in V["$app"]]: EntryFor<RoutesFor<V, K>> } & { [K in VossApp]?: ComponentType<AppProps> } }): AppsDef;
|
|
@@ -111,7 +111,7 @@ export async function api(kind: "fire" | "read" | "state" | "raw", scope: string
|
|
|
111
111
|
* The baba's manifest, as the server describes it: null until it arrives.
|
|
112
112
|
* Asked once, then asked again "since the generation I have", so the answer
|
|
113
113
|
* comes when the baba reloads: a page that draws the manifest, the Maker's
|
|
114
|
-
* objects or the
|
|
114
|
+
* objects or the agentic instructions, follows a change to the code as the state
|
|
115
115
|
* follows a round. A baba that is down is asked again in a moment.
|
|
116
116
|
*/
|
|
117
117
|
export function useManifest(): Manifest | null {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|