babavoss 0.0.1 → 0.0.2

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.
Files changed (158) hide show
  1. package/NOTICE +7 -0
  2. package/bin/voss.ts +48 -0
  3. package/gui/babavoss-web.js +234 -0
  4. package/gui/chunk-5hpp1ypv.js +11710 -0
  5. package/gui/chunk-9rq662fd.js +8627 -0
  6. package/gui/chunk-k3cm8j6r.js +433 -0
  7. package/gui/chunk-pk09y98y.js +50 -0
  8. package/gui/chunk-smz02qa6.js +186 -0
  9. package/gui/chunk-wwqypxre.js +49 -0
  10. package/gui/gui.js +2015 -0
  11. package/gui/react-compiler-runtime.js +39 -0
  12. package/gui/react-dom-client.js +21 -0
  13. package/gui/react-dom.js +44 -0
  14. package/gui/react-jsx-runtime.js +19 -0
  15. package/gui/react.js +105 -0
  16. package/gui/theme.css +3053 -0
  17. package/index.ts +15 -0
  18. package/package.json +50 -4
  19. package/src/baba/check.ts +90 -0
  20. package/src/baba/config.ts +261 -0
  21. package/src/baba/find.ts +12 -0
  22. package/src/baba/init.ts +176 -0
  23. package/src/baba/node.ts +483 -0
  24. package/src/baba/project.ts +63 -0
  25. package/src/baba/registry.ts +35 -0
  26. package/src/baba/worker.ts +55 -0
  27. package/src/bench/index.ts +6 -0
  28. package/src/bench/measure.ts +132 -0
  29. package/src/bench/scenarios.ts +136 -0
  30. package/src/build/builder.ts +74 -0
  31. package/src/build/failure.ts +78 -0
  32. package/src/build/guard.ts +85 -0
  33. package/src/build/mdx-register.ts +3 -0
  34. package/src/build/mdx.ts +38 -0
  35. package/src/build/project.ts +38 -0
  36. package/src/build/views.ts +146 -0
  37. package/src/builder/main.ts +29 -0
  38. package/src/desktop/bob.ts +76 -0
  39. package/src/desktop/desktop.css +111 -0
  40. package/src/desktop/icons.ts +50 -0
  41. package/src/desktop/index.ts +323 -0
  42. package/src/desktop/routes.ts +98 -0
  43. package/src/desktop/view.tsx +673 -0
  44. package/src/door/core.ts +384 -0
  45. package/src/ecs/baba.ts +431 -0
  46. package/src/ecs/codec.ts +334 -0
  47. package/src/ecs/handles.ts +91 -0
  48. package/src/ecs/replica.ts +150 -0
  49. package/src/ecs/runtime.ts +603 -0
  50. package/src/ecs/scheduler.ts +75 -0
  51. package/src/ecs/snapshot.ts +102 -0
  52. package/src/ecs/state.ts +759 -0
  53. package/src/ecs/system.ts +256 -0
  54. package/src/ecs/table.ts +420 -0
  55. package/src/ecs/testbed.ts +97 -0
  56. package/src/exec/host.ts +177 -0
  57. package/src/exec/main.ts +98 -0
  58. package/src/exec/watch.ts +7 -0
  59. package/src/exec/wire.ts +29 -0
  60. package/src/generated/build.ts +4 -0
  61. package/src/gui/css.d.ts +1 -0
  62. package/src/gui/gui.tsx +245 -0
  63. package/src/gui/index.ts +51 -0
  64. package/src/gui/inspector.tsx +47 -0
  65. package/src/gui/levels.tsx +73 -0
  66. package/src/gui/promptware.tsx +68 -0
  67. package/src/gui/runner.tsx +118 -0
  68. package/src/gui/theme.css +498 -0
  69. package/src/gui/theme.ts +25 -0
  70. package/src/gui/wizard.tsx +227 -0
  71. package/src/guide/add-a-desktop.mdx +100 -0
  72. package/src/guide/compose-an-interface.mdx +84 -0
  73. package/src/guide/index.ts +13 -0
  74. package/src/guide/reach-outside.mdx +112 -0
  75. package/src/guide/spec-a-system.mdx +93 -0
  76. package/src/guide/systems-together.mdx +72 -0
  77. package/src/guide/write-a-system.mdx +183 -0
  78. package/src/guide/write-promptware.mdx +90 -0
  79. package/src/http/server.ts +310 -0
  80. package/src/kernel/build.ts +21 -0
  81. package/src/kernel/builder.ts +105 -0
  82. package/src/kernel/children.ts +117 -0
  83. package/src/kernel/context.ts +90 -0
  84. package/src/kernel/lock.ts +46 -0
  85. package/src/kernel/names.ts +14 -0
  86. package/src/kernel/schema.ts +130 -0
  87. package/src/kernel/where.ts +12 -0
  88. package/src/kit/index.ts +232 -0
  89. package/src/maker/system.ts +213 -0
  90. package/src/mcp/daemon.ts +61 -0
  91. package/src/mcp/main.ts +208 -0
  92. package/src/mcp/rpc.ts +64 -0
  93. package/src/mcp/tools.ts +125 -0
  94. package/src/prompt/evals.ts +42 -0
  95. package/src/prompt/index.ts +242 -0
  96. package/src/prompt/jsx-dev-runtime.ts +1 -0
  97. package/src/prompt/jsx-runtime.ts +49 -0
  98. package/src/prompt/mdx.d.ts +1 -0
  99. package/src/promptware/compile.ts +183 -0
  100. package/src/promptware/define.ts +16 -0
  101. package/src/promptware/disk.ts +72 -0
  102. package/src/promptware/markdown.d.ts +6 -0
  103. package/src/promptware/sync.ts +437 -0
  104. package/src/promptware/system.ts +215 -0
  105. package/src/runtime/bridge.ts +85 -0
  106. package/src/runtime/connect.ts +54 -0
  107. package/src/runtime/env.ts +35 -0
  108. package/src/runtime/harness.ts +80 -0
  109. package/src/runtime/main.ts +119 -0
  110. package/src/runtime/worker.ts +33 -0
  111. package/src/server/edge.ts +332 -0
  112. package/src/server/main.ts +45 -0
  113. package/src/server/messages.ts +97 -0
  114. package/src/server/protocol.ts +37 -0
  115. package/src/services/args.ts +45 -0
  116. package/src/services/exec.ts +69 -0
  117. package/src/services/fs.ts +139 -0
  118. package/src/services/http.ts +30 -0
  119. package/src/services/index.ts +113 -0
  120. package/src/services/secrets.ts +18 -0
  121. package/src/shell/address.ts +21 -0
  122. package/src/shell/args.ts +219 -0
  123. package/src/shell/client.ts +107 -0
  124. package/src/shell/codes.ts +26 -0
  125. package/src/shell/positional.ts +20 -0
  126. package/src/shell/run.ts +470 -0
  127. package/src/shell/service.ts +167 -0
  128. package/src/shell/state.ts +204 -0
  129. package/src/spec/adapters.ts +72 -0
  130. package/src/spec/diff.ts +26 -0
  131. package/src/spec/files.ts +17 -0
  132. package/src/spec/index.ts +155 -0
  133. package/src/spec/run.ts +97 -0
  134. package/src/spec/take.ts +54 -0
  135. package/src/test/index.ts +8 -0
  136. package/src/test/prove.ts +56 -0
  137. package/src/test/records.ts +23 -0
  138. package/src/test/specs.ts +56 -0
  139. package/src/test/steps.ts +100 -0
  140. package/src/test/voss-dir.ts +17 -0
  141. package/src/transport/messages.ts +110 -0
  142. package/src/transport/transport.ts +62 -0
  143. package/src/wall/probe.ts +67 -0
  144. package/src/wall/profile.ts +103 -0
  145. package/src/wall/spawn.ts +59 -0
  146. package/src/web/app.tsx +53 -0
  147. package/src/web/core.tsx +140 -0
  148. package/src/web/form.ts +155 -0
  149. package/src/web/hooks.ts +135 -0
  150. package/src/web/index.tsx +17 -0
  151. package/src/web/list.ts +19 -0
  152. package/src/web/maker.tsx +766 -0
  153. package/src/web/objects.tsx +213 -0
  154. package/src/web/socket.ts +84 -0
  155. package/src/web/state.tsx +69 -0
  156. package/src/web/store.ts +221 -0
  157. package/src/web/ui.tsx +135 -0
  158. package/README.md +0 -5
package/src/web/ui.tsx ADDED
@@ -0,0 +1,135 @@
1
+ // The kit: a few components over the one theme stylesheet the page loads.
2
+ // Plain elements with classes; a view may use them or write its own markup,
3
+ // which the theme also styles.
4
+ import { useEffect, useRef, useState, type KeyboardEvent, type ButtonHTMLAttributes, type InputHTMLAttributes, type ReactNode, type SelectHTMLAttributes, type TextareaHTMLAttributes } from "react";
5
+ import { filterItems, move, type Item } from "./list.ts";
6
+
7
+ const cx = (...c: (string | false | null | undefined)[]) => c.filter(Boolean).join(" ");
8
+
9
+ export type ButtonVariant = "default" | "primary" | "quiet" | "danger";
10
+
11
+ export function Button({ variant = "default", className, type = "button", ...rest }: ButtonHTMLAttributes<HTMLButtonElement> & { variant?: ButtonVariant }) {
12
+ return <button type={type} className={cx("bv-button", variant !== "default" && `bv-${variant}`, className)} {...rest} />;
13
+ }
14
+
15
+ export function Input({ className, ...rest }: InputHTMLAttributes<HTMLInputElement>) {
16
+ return <input className={cx("bv-input", className)} {...rest} />;
17
+ }
18
+
19
+ export function Textarea({ className, ...rest }: TextareaHTMLAttributes<HTMLTextAreaElement>) {
20
+ return <textarea className={cx("bv-input", "bv-textarea", className)} {...rest} />;
21
+ }
22
+
23
+ export function Select({ className, ...rest }: SelectHTMLAttributes<HTMLSelectElement>) {
24
+ return <select className={cx("bv-input", "bv-select", className)} {...rest} />;
25
+ }
26
+
27
+ export function Kbd({ children }: { children: ReactNode }) {
28
+ return <kbd className="bv-kbd">{children}</kbd>;
29
+ }
30
+
31
+ /** A block with a head: a title, and actions on the right. */
32
+ export function Panel({ title, actions, children, className }: { title?: ReactNode; actions?: ReactNode; children?: ReactNode; className?: string }) {
33
+ return (
34
+ <section className={cx("bv-panel", className)}>
35
+ {(title || actions) && <header className="bv-panel-head"><span className="bv-panel-title">{title}</span>{actions}</header>}
36
+ <div className="bv-panel-body">{children}</div>
37
+ </section>
38
+ );
39
+ }
40
+
41
+ /** Rows of a list: each a line, clickable when it has onClick. */
42
+ export function Rows({ children }: { children: ReactNode }) {
43
+ return <div className="bv-rows" role="list">{children}</div>;
44
+ }
45
+
46
+ export function Row({ children, hint, onClick, active }: { children: ReactNode; hint?: ReactNode; onClick?: () => void; active?: boolean }) {
47
+ const body = <><span className="bv-row-label">{children}</span>{hint != null && <span className="bv-row-hint">{hint}</span>}</>;
48
+ return onClick
49
+ ? <button type="button" role="listitem" className={cx("bv-row", "bv-row-button", active && "bv-active")} onClick={onClick}>{body}</button>
50
+ : <div role="listitem" className={cx("bv-row", active && "bv-active")}>{body}</div>;
51
+ }
52
+
53
+ /** A table of rows by column. Cells are shown as text; objects as JSON. */
54
+ export function Table({ columns, rows }: { columns: string[]; rows: Record<string, unknown>[] }) {
55
+ const cell = (v: unknown) => (v === undefined ? "" : v === null ? "null" : typeof v === "object" ? JSON.stringify(v) : String(v));
56
+ return (
57
+ <div className="bv-table-wrap">
58
+ <table className="bv-table">
59
+ <thead><tr>{columns.map((c) => <th key={c}>{c}</th>)}</tr></thead>
60
+ <tbody>{rows.map((r, i) => <tr key={i}>{columns.map((c) => <td key={c}>{cell(r[c])}</td>)}</tr>)}</tbody>
61
+ </table>
62
+ </div>
63
+ );
64
+ }
65
+
66
+ /** A modal dialog over the page. Escape and a click outside close it. */
67
+ export function Dialog({ open, title, onClose, children, footer }: { open: boolean; title: ReactNode; onClose: () => void; children?: ReactNode; footer?: ReactNode }) {
68
+ const ref = useRef<HTMLDivElement>(null);
69
+ useEffect(() => {
70
+ if (!open) return;
71
+ const before = document.activeElement as HTMLElement | null;
72
+ ref.current?.focus();
73
+ return () => before?.focus?.();
74
+ }, [open]);
75
+ if (!open) return null;
76
+ return (
77
+ <div className="bv-overlay" onPointerDown={(e) => { if (e.target === e.currentTarget) onClose(); }}>
78
+ <div ref={ref} className="bv-dialog" role="dialog" aria-modal="true" aria-label={typeof title === "string" ? title : undefined} tabIndex={-1}
79
+ onKeyDown={(e) => { if (e.key === "Escape") { e.stopPropagation(); onClose(); } }}>
80
+ <header className="bv-dialog-head">{title}</header>
81
+ <div className="bv-dialog-body">{children}</div>
82
+ <footer className="bv-dialog-foot">{footer ?? <Button onClick={onClose}>Close</Button>}</footer>
83
+ </div>
84
+ </div>
85
+ );
86
+ }
87
+
88
+ /**
89
+ * A filter over a grouped list of commands, driven by the keyboard: arrows
90
+ * move, Enter runs, Escape leaves.
91
+ */
92
+ export function CommandList<T extends Item>({ items, onRun, onEscape, placeholder = "Type to filter", empty = "Nothing matches." }: {
93
+ items: T[]; onRun: (item: T) => void; onEscape?: () => void; placeholder?: string; empty?: ReactNode;
94
+ }) {
95
+ const [query, setQuery] = useState("");
96
+ const [index, setIndex] = useState(0);
97
+ const list = useRef<HTMLDivElement>(null);
98
+ const shown = filterItems(items, query);
99
+ const at = Math.min(index, Math.max(0, shown.length - 1));
100
+ useEffect(() => {
101
+ list.current?.querySelector<HTMLElement>(`[data-index="${at}"]`)?.scrollIntoView({ block: "nearest" });
102
+ }, [at]);
103
+ const key = (e: KeyboardEvent) => {
104
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") { e.preventDefault(); setIndex(move(at, e.key === "ArrowDown" ? 1 : -1, shown.length)); }
105
+ else if (e.key === "Home") { e.preventDefault(); setIndex(0); }
106
+ else if (e.key === "End") { e.preventDefault(); setIndex(Math.max(0, shown.length - 1)); }
107
+ else if (e.key === "Enter") { e.preventDefault(); const it = shown[at]; if (it) onRun(it); }
108
+ else if (e.key === "Escape") { e.preventDefault(); e.stopPropagation(); onEscape?.(); }
109
+ };
110
+ let group: string | null = null;
111
+ return (
112
+ <div className="bv-cmd" onKeyDown={key}>
113
+ <input className="bv-cmd-input" autoFocus value={query} placeholder={placeholder} aria-label={placeholder}
114
+ role="combobox" aria-expanded="true" aria-controls="bv-cmd-list" aria-activedescendant={shown[at] ? `bv-cmd-${at}` : undefined}
115
+ onChange={(e) => { setQuery(e.target.value); setIndex(0); }} />
116
+ <div className="bv-cmd-list" id="bv-cmd-list" role="listbox" ref={list}>
117
+ {shown.length === 0 && <div className="bv-cmd-empty">{empty}</div>}
118
+ {shown.map((it, i) => {
119
+ const head = it.group !== group ? <div className="bv-cmd-group" role="presentation">{it.group}</div> : null;
120
+ group = it.group;
121
+ return (
122
+ <div key={it.id} role="presentation">
123
+ {head}
124
+ <div id={`bv-cmd-${i}`} role="option" aria-selected={i === at} data-index={i} className={cx("bv-cmd-item", i === at && "bv-active")}
125
+ onPointerMove={() => i !== at && setIndex(i)} onClick={() => onRun(it)}>
126
+ <span className="bv-cmd-label">{it.label}</span>
127
+ {it.hint && <span className="bv-cmd-hint">{it.hint}</span>}
128
+ </div>
129
+ </div>
130
+ );
131
+ })}
132
+ </div>
133
+ </div>
134
+ );
135
+ }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # babavoss
2
-
3
- Baba Voss: a project's own program, run by voss.
4
-
5
- Not yet released. See https://babavoss.org.