@hackbuild/agents-views 0.1.0 → 0.1.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.
- package/README.md +114 -75
- package/dist/agents-views.iife.js +205 -4
- package/dist/associations-table.d.ts +11 -1
- package/dist/associations-table.js +1 -0
- package/dist/drives-bars.d.ts +9 -1
- package/dist/drives-bars.js +1 -0
- package/dist/elements.d.ts +1 -0
- package/dist/elements.js +1 -0
- package/dist/eye-inset.d.ts +15 -1
- package/dist/eye-inset.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/map-inset.d.ts +34 -0
- package/dist/map-inset.js +60 -0
- package/dist/plan-log.d.ts +76 -0
- package/dist/plan-log.js +106 -0
- package/dist/vue.d.ts +74 -0
- package/dist/vue.js +58 -0
- package/llms.md +476 -0
- package/package.json +2 -1
package/dist/eye-inset.d.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
export interface EyeLike {
|
|
3
3
|
render(draw: () => void): void;
|
|
4
4
|
}
|
|
5
|
+
/** One choice of the who switch: whose eyes the card draws. */
|
|
5
6
|
export interface EyeWho {
|
|
7
|
+
/** the id `select` and `onWho` use */
|
|
6
8
|
id: string;
|
|
7
9
|
/** the switch label, as "dog eye" */
|
|
8
10
|
label: string;
|
|
@@ -11,7 +13,9 @@ export interface EyeWho {
|
|
|
11
13
|
/** the eye whose render wraps the draw, so its own head is hidden */
|
|
12
14
|
eye?: EyeLike;
|
|
13
15
|
}
|
|
16
|
+
/** Options of `eyeInset`. */
|
|
14
17
|
export interface EyeInsetOptions {
|
|
18
|
+
/** the who switch, at least one */
|
|
15
19
|
who: readonly EyeWho[];
|
|
16
20
|
/** the selected id; the first by default */
|
|
17
21
|
selected?: string;
|
|
@@ -20,22 +24,32 @@ export interface EyeInsetOptions {
|
|
|
20
24
|
* is an eye. A returned string becomes the mode line.
|
|
21
25
|
*/
|
|
22
26
|
draw: (canvas: HTMLCanvasElement, who: EyeWho) => string | void;
|
|
23
|
-
/** canvas pixels (default 320
|
|
27
|
+
/** canvas width in pixels (default 320) */
|
|
24
28
|
width?: number;
|
|
29
|
+
/** canvas height in pixels (default 160) */
|
|
25
30
|
height?: number;
|
|
26
31
|
/** the canvas, when a renderer owns it already (a three WebGLRenderer's) */
|
|
27
32
|
canvas?: HTMLCanvasElement;
|
|
33
|
+
/** the head title (default "eye") */
|
|
34
|
+
title?: string;
|
|
35
|
+
/** the user picked another who */
|
|
28
36
|
onWho?: (id: string) => void;
|
|
29
37
|
}
|
|
38
|
+
/** What `eyeInset` returns: the canvas, the selected who and the frame call. */
|
|
30
39
|
export interface EyeInsetHandle {
|
|
40
|
+
/** the host element, now the card */
|
|
31
41
|
readonly root: HTMLElement;
|
|
42
|
+
/** the canvas `draw` paints */
|
|
32
43
|
readonly canvas: HTMLCanvasElement;
|
|
44
|
+
/** the selected who */
|
|
33
45
|
readonly who: EyeWho;
|
|
46
|
+
/** selects a who without calling `onWho` */
|
|
34
47
|
select(id: string): void;
|
|
35
48
|
/** draws one frame of the selected eye */
|
|
36
49
|
frame(): void;
|
|
37
50
|
/** sets the mode line */
|
|
38
51
|
mode(text: string): void;
|
|
52
|
+
/** empties the host and removes the card classes */
|
|
39
53
|
dispose(): void;
|
|
40
54
|
}
|
|
41
55
|
/** Makes `host` the eye card: head with the mode line, the who switch, the canvas. */
|
package/dist/eye-inset.js
CHANGED
|
@@ -16,7 +16,7 @@ export function eyeInset(host, o) {
|
|
|
16
16
|
let sel = o.who.find((x) => x.id === o.selected) ?? o.who[0];
|
|
17
17
|
// the head as hackbuild-ui's HbInset with who: title, the who switch (.hb-inset-who), the mode line
|
|
18
18
|
const hd = el(doc, "div", "hb-inset-hd");
|
|
19
|
-
const title = el(doc, "span", "hb-inset-title", "eye");
|
|
19
|
+
const title = el(doc, "span", "hb-inset-title", o.title ?? "eye");
|
|
20
20
|
const aux = el(doc, "span", "hb-hd-aux");
|
|
21
21
|
const whoGroup = el(doc, "span", "hb-inset-who");
|
|
22
22
|
whoGroup.setAttribute("role", "group");
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type EyeInsetHandle } from "./eye-inset.js";
|
|
2
|
+
/** The map as the view reads it. */
|
|
3
|
+
export interface MapState {
|
|
4
|
+
/** cells across and down */
|
|
5
|
+
cols: number;
|
|
6
|
+
rows: number;
|
|
7
|
+
/** row major, 0 unknown, 1 free, 2 blocked */
|
|
8
|
+
cells: ArrayLike<number>;
|
|
9
|
+
/** half the floor's side in metres; the map spans x and z from -half to half */
|
|
10
|
+
half: number;
|
|
11
|
+
/** points walked, in metres */
|
|
12
|
+
trail: readonly {
|
|
13
|
+
x: number;
|
|
14
|
+
z: number;
|
|
15
|
+
}[];
|
|
16
|
+
/** where the body is */
|
|
17
|
+
at: {
|
|
18
|
+
x: number;
|
|
19
|
+
z: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** Draws one frame of the map; returns the mode line, as "212 cells seen". */
|
|
23
|
+
export declare function drawMap(canvas: HTMLCanvasElement, m: MapState): string;
|
|
24
|
+
/** Options of `mapInset`. */
|
|
25
|
+
export interface MapInsetOptions {
|
|
26
|
+
/** the map now; read on every `frame()` */
|
|
27
|
+
map: () => MapState;
|
|
28
|
+
/** canvas side in pixels (default 160) */
|
|
29
|
+
size?: number;
|
|
30
|
+
/** the head title (default "map") */
|
|
31
|
+
label?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Makes `host` the map card; call `frame()` to draw. */
|
|
34
|
+
export declare function mapInset(host: HTMLElement, o: MapInsetOptions): EyeInsetHandle;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// MapInset: the map a body builds from its own depth, drawn as an inset on
|
|
2
|
+
// the stage. Ported from the room original: a grid of cells (unknown, free,
|
|
3
|
+
// blocked) over the floor, the trail walked in pink and the body as a pink
|
|
4
|
+
// dot. Colours come from the hackbuild-ui tokens on the canvas, so the map
|
|
5
|
+
// follows the theme. The card is an EyeInset with one who.
|
|
6
|
+
import { eyeInset } from "./eye-inset.js";
|
|
7
|
+
const token = (c, name, or) => {
|
|
8
|
+
const v = typeof getComputedStyle === "function" ? getComputedStyle(c).getPropertyValue(name).trim() : "";
|
|
9
|
+
return v || or;
|
|
10
|
+
};
|
|
11
|
+
/** Draws one frame of the map; returns the mode line, as "212 cells seen". */
|
|
12
|
+
export function drawMap(canvas, m) {
|
|
13
|
+
const g = canvas.getContext("2d");
|
|
14
|
+
if (!g)
|
|
15
|
+
return "";
|
|
16
|
+
const W = canvas.width;
|
|
17
|
+
const H = canvas.height;
|
|
18
|
+
const s = Math.min(W, H) / (m.half * 2);
|
|
19
|
+
const ox = (W - s * m.half * 2) / 2;
|
|
20
|
+
const oy = (H - s * m.half * 2) / 2;
|
|
21
|
+
const pink = token(canvas, "--hb-pink", "#fe0386");
|
|
22
|
+
g.fillStyle = token(canvas, "--hb-paper-sunk", "#efe9db");
|
|
23
|
+
g.fillRect(0, 0, W, H);
|
|
24
|
+
const cw = (m.half * 2 * s) / m.cols;
|
|
25
|
+
const ch = (m.half * 2 * s) / m.rows;
|
|
26
|
+
const free = token(canvas, "--hb-paper-raised", "#fffdf7");
|
|
27
|
+
const wall = token(canvas, "--hb-ink", "#1a1a1a");
|
|
28
|
+
let seen = 0;
|
|
29
|
+
for (let k = 0; k < m.cells.length; k++) {
|
|
30
|
+
const v = m.cells[k];
|
|
31
|
+
if (!v)
|
|
32
|
+
continue;
|
|
33
|
+
seen++;
|
|
34
|
+
g.fillStyle = v === 2 ? wall : free;
|
|
35
|
+
g.fillRect(ox + (k % m.cols) * cw, oy + Math.floor(k / m.cols) * ch, Math.ceil(cw), Math.ceil(ch));
|
|
36
|
+
}
|
|
37
|
+
const px = (x) => ox + (x + m.half) * s;
|
|
38
|
+
const pz = (z) => oy + (z + m.half) * s;
|
|
39
|
+
g.strokeStyle = pink;
|
|
40
|
+
g.lineWidth = 1.5;
|
|
41
|
+
g.beginPath();
|
|
42
|
+
m.trail.forEach((p, i) => (i ? g.lineTo(px(p.x), pz(p.z)) : g.moveTo(px(p.x), pz(p.z))));
|
|
43
|
+
g.stroke();
|
|
44
|
+
g.fillStyle = pink;
|
|
45
|
+
g.beginPath();
|
|
46
|
+
g.arc(px(m.at.x), pz(m.at.z), 4, 0, Math.PI * 2);
|
|
47
|
+
g.fill();
|
|
48
|
+
return `${seen} cells seen`;
|
|
49
|
+
}
|
|
50
|
+
/** Makes `host` the map card; call `frame()` to draw. */
|
|
51
|
+
export function mapInset(host, o) {
|
|
52
|
+
const size = o.size ?? 160;
|
|
53
|
+
return eyeInset(host, {
|
|
54
|
+
who: [{ id: "map", label: o.label ?? "map", title: "the map he built" }],
|
|
55
|
+
draw: (c) => drawMap(c, o.map()),
|
|
56
|
+
title: o.label ?? "map",
|
|
57
|
+
width: size,
|
|
58
|
+
height: size,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** One step as the log shows it. */
|
|
2
|
+
export interface StepLine {
|
|
3
|
+
/** ms since epoch */
|
|
4
|
+
t: number;
|
|
5
|
+
line: string;
|
|
6
|
+
ok: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** A thought it had with no order: a mutter, or a reflection on what it attends to. */
|
|
9
|
+
export interface ThoughtLine {
|
|
10
|
+
t: number;
|
|
11
|
+
kind: string;
|
|
12
|
+
line: string;
|
|
13
|
+
}
|
|
14
|
+
/** What PlanLog draws. Built with `planBook`, or by hand. */
|
|
15
|
+
export interface PlanLogState {
|
|
16
|
+
/** the last plan in one line, "" for none */
|
|
17
|
+
plan: string;
|
|
18
|
+
/** who made it: rules, reused, model */
|
|
19
|
+
via: string;
|
|
20
|
+
goals: readonly string[];
|
|
21
|
+
thoughts: readonly ThoughtLine[];
|
|
22
|
+
steps: readonly StepLine[];
|
|
23
|
+
}
|
|
24
|
+
/** The parts of a @hackbuild/agent event the book reads. */
|
|
25
|
+
export type PlanEventLike = {
|
|
26
|
+
type: "plan";
|
|
27
|
+
via: string;
|
|
28
|
+
plan: {
|
|
29
|
+
think?: string;
|
|
30
|
+
do: readonly {
|
|
31
|
+
tool: string;
|
|
32
|
+
args: readonly unknown[];
|
|
33
|
+
}[];
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
type: "step";
|
|
37
|
+
result: {
|
|
38
|
+
ok: boolean;
|
|
39
|
+
text: string;
|
|
40
|
+
step: {
|
|
41
|
+
tool: string;
|
|
42
|
+
args: readonly unknown[];
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
} | {
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
/** The book behind PlanLog and StepLog: push agent events, thoughts and goals; read `state()`. */
|
|
49
|
+
export interface PlanBook {
|
|
50
|
+
/** Takes a plan or a step event; true when the state changed. */
|
|
51
|
+
push(e: PlanEventLike): boolean;
|
|
52
|
+
think(kind: string, line: string): void;
|
|
53
|
+
setGoals(lines: readonly string[]): void;
|
|
54
|
+
state(): PlanLogState;
|
|
55
|
+
clear(): void;
|
|
56
|
+
}
|
|
57
|
+
/** A plan book keeping at most `max` steps and thoughts (default 200). */
|
|
58
|
+
export declare function planBook(o?: {
|
|
59
|
+
max?: number;
|
|
60
|
+
now?: () => number;
|
|
61
|
+
}): PlanBook;
|
|
62
|
+
/** What `stepLog` and `planLog` return. */
|
|
63
|
+
export interface LogHandle<S> {
|
|
64
|
+
update(state: S): void;
|
|
65
|
+
dispose(): void;
|
|
66
|
+
}
|
|
67
|
+
/** The step log: one rack log row per tool call. */
|
|
68
|
+
export declare function stepLog(host: HTMLElement, o?: {
|
|
69
|
+
empty?: string;
|
|
70
|
+
label?: string;
|
|
71
|
+
}): LogHandle<readonly StepLine[]>;
|
|
72
|
+
/** The plan log: last plan with who made it, goals, thoughts, and the step log under them. */
|
|
73
|
+
export declare function planLog(host: HTMLElement, o?: {
|
|
74
|
+
steps?: boolean;
|
|
75
|
+
empty?: string;
|
|
76
|
+
}): LogHandle<PlanLogState>;
|
package/dist/plan-log.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// PlanLog and StepLog: what an agent decided and what each step did.
|
|
2
|
+
// Ported from the room originals' mind tab: the last plan with who made it
|
|
3
|
+
// (rules, a reused plan or the model), the goals kept until done, the
|
|
4
|
+
// thoughts it had on its own (mutters, reflections), and a step log, one
|
|
5
|
+
// row per tool call with ok or warn at the right edge. The rows are
|
|
6
|
+
// hackbuild-ui's rack log (.hb-racklog).
|
|
7
|
+
import { el, panel, stack } from "./dom.js";
|
|
8
|
+
const VIA = { reflex: "rules", cache: "reused", model: "model", planner: "planner" };
|
|
9
|
+
const call = (s) => `${s.tool}(${s.args.map(String).join(", ")})`;
|
|
10
|
+
/** A plan book keeping at most `max` steps and thoughts (default 200). */
|
|
11
|
+
export function planBook(o = {}) {
|
|
12
|
+
const max = o.max ?? 200;
|
|
13
|
+
const now = o.now ?? (() => Date.now());
|
|
14
|
+
let s = { plan: "", via: "", goals: [], thoughts: [], steps: [] };
|
|
15
|
+
return {
|
|
16
|
+
push(e) {
|
|
17
|
+
if (e.type === "plan" && "plan" in e) {
|
|
18
|
+
const p = e.plan;
|
|
19
|
+
s = { ...s, via: VIA[e.via] ?? e.via, plan: `${p.think ? `${p.think}. ` : ""}${p.do.map(call).join(", ") || "no steps"}` };
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (e.type === "step" && "result" in e) {
|
|
23
|
+
const r = e.result;
|
|
24
|
+
s = { ...s, steps: [...s.steps.slice(1 - max), { t: now(), line: `${call(r.step)}: ${r.text}`, ok: r.ok }] };
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
},
|
|
29
|
+
think(kind, line) {
|
|
30
|
+
s = { ...s, thoughts: [...s.thoughts.slice(1 - max), { t: now(), kind, line }] };
|
|
31
|
+
},
|
|
32
|
+
setGoals(lines) {
|
|
33
|
+
s = { ...s, goals: [...lines] };
|
|
34
|
+
},
|
|
35
|
+
state: () => s,
|
|
36
|
+
clear() {
|
|
37
|
+
s = { plan: "", via: "", goals: [], thoughts: [], steps: [] };
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const clock = (t) => new Date(t).toTimeString().slice(0, 8);
|
|
42
|
+
/** Fills an `ol.hb-racklog` with step rows, newest at the foot. */
|
|
43
|
+
function rows(list, steps) {
|
|
44
|
+
const doc = list.ownerDocument;
|
|
45
|
+
const follow = list.scrollHeight - list.scrollTop - list.clientHeight < 8;
|
|
46
|
+
list.classList.toggle("is-empty", !steps.length);
|
|
47
|
+
list.replaceChildren(...steps.map((x) => {
|
|
48
|
+
const li = el(doc, "li", `hb-racklog-row is-${x.ok ? "ok" : "warn"}`);
|
|
49
|
+
li.append(el(doc, "time", "hb-racklog-t", clock(x.t)), el(doc, "span", "hb-racklog-line", x.line), el(doc, "span", "hb-racklog-level", x.ok ? "ok" : "warn"));
|
|
50
|
+
return li;
|
|
51
|
+
}));
|
|
52
|
+
if (follow)
|
|
53
|
+
list.scrollTop = list.scrollHeight;
|
|
54
|
+
}
|
|
55
|
+
function logList(doc, label, empty) {
|
|
56
|
+
const list = el(doc, "ol", "hb-racklog is-empty");
|
|
57
|
+
list.setAttribute("role", "log");
|
|
58
|
+
list.setAttribute("aria-live", "polite");
|
|
59
|
+
list.setAttribute("aria-label", label);
|
|
60
|
+
list.dataset.empty = empty;
|
|
61
|
+
list.tabIndex = 0;
|
|
62
|
+
return list;
|
|
63
|
+
}
|
|
64
|
+
/** The step log: one rack log row per tool call. */
|
|
65
|
+
export function stepLog(host, o = {}) {
|
|
66
|
+
const list = logList(host.ownerDocument, o.label ?? "steps", o.empty ?? "no steps yet.");
|
|
67
|
+
host.replaceChildren(list);
|
|
68
|
+
return { update: (steps) => rows(list, steps), dispose: () => host.replaceChildren() };
|
|
69
|
+
}
|
|
70
|
+
/** The plan log: last plan with who made it, goals, thoughts, and the step log under them. */
|
|
71
|
+
export function planLog(host, o = {}) {
|
|
72
|
+
const doc = host.ownerDocument;
|
|
73
|
+
const col = stack(host);
|
|
74
|
+
const plan = panel(doc, "last plan");
|
|
75
|
+
const planText = el(doc, "p", "hb-note", o.empty ?? "none yet. give an order.");
|
|
76
|
+
const goals = el(doc, "ul", "hb-list");
|
|
77
|
+
plan.root.append(planText, goals);
|
|
78
|
+
const thoughts = panel(doc, "thoughts");
|
|
79
|
+
const thoughtList = el(doc, "ul", "hb-list");
|
|
80
|
+
thoughts.root.append(thoughtList);
|
|
81
|
+
const steps = panel(doc, "steps");
|
|
82
|
+
const list = logList(doc, "steps", "no steps yet.");
|
|
83
|
+
steps.root.append(list);
|
|
84
|
+
col.append(plan.root, thoughts.root, ...(o.steps === false ? [] : [steps.root]));
|
|
85
|
+
host.replaceChildren(col);
|
|
86
|
+
return {
|
|
87
|
+
update(s) {
|
|
88
|
+
plan.aux.textContent = s.via;
|
|
89
|
+
planText.textContent = s.plan || (o.empty ?? "none yet. give an order.");
|
|
90
|
+
goals.hidden = !s.goals.length;
|
|
91
|
+
goals.replaceChildren(...s.goals.map((g) => el(doc, "li", "", `goal ${g}`)));
|
|
92
|
+
thoughts.root.hidden = !s.thoughts.length;
|
|
93
|
+
thoughts.aux.textContent = s.thoughts.length ? String(s.thoughts.length) : "";
|
|
94
|
+
thoughtList.replaceChildren(...s.thoughts
|
|
95
|
+
.slice(-8)
|
|
96
|
+
.reverse()
|
|
97
|
+
.map((x) => {
|
|
98
|
+
const li = el(doc, "li");
|
|
99
|
+
li.append(el(doc, "b", "", x.kind), doc.createTextNode(` ${x.line}`));
|
|
100
|
+
return li;
|
|
101
|
+
}));
|
|
102
|
+
rows(list, s.steps);
|
|
103
|
+
},
|
|
104
|
+
dispose: () => host.replaceChildren(),
|
|
105
|
+
};
|
|
106
|
+
}
|
package/dist/vue.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type PropType } from "vue";
|
|
|
2
2
|
import { type AssociationsState } from "./associations-table.js";
|
|
3
3
|
import { type DrivesBarsState } from "./drives-bars.js";
|
|
4
4
|
import { type EyeWho } from "./eye-inset.js";
|
|
5
|
+
import { type MapState } from "./map-inset.js";
|
|
6
|
+
import { type PlanLogState, type StepLine } from "./plan-log.js";
|
|
5
7
|
/** The behavior block, utility rows (current in pink) and drive rows. */
|
|
6
8
|
export declare const DrivesBars: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
9
|
state: {
|
|
@@ -107,3 +109,75 @@ export declare const EyeInset: import("vue").DefineComponent<import("vue").Extra
|
|
|
107
109
|
width: number;
|
|
108
110
|
height: number;
|
|
109
111
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
112
|
+
/** The plan log: last plan, goals, thoughts and steps. `steps: false` leaves the step log out. */
|
|
113
|
+
export declare const PlanLog: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
114
|
+
state: {
|
|
115
|
+
type: PropType<PlanLogState>;
|
|
116
|
+
required: true;
|
|
117
|
+
};
|
|
118
|
+
steps: {
|
|
119
|
+
type: BooleanConstructor;
|
|
120
|
+
default: boolean;
|
|
121
|
+
};
|
|
122
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
123
|
+
[key: string]: any;
|
|
124
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
125
|
+
state: {
|
|
126
|
+
type: PropType<PlanLogState>;
|
|
127
|
+
required: true;
|
|
128
|
+
};
|
|
129
|
+
steps: {
|
|
130
|
+
type: BooleanConstructor;
|
|
131
|
+
default: boolean;
|
|
132
|
+
};
|
|
133
|
+
}>> & Readonly<{}>, {
|
|
134
|
+
steps: boolean;
|
|
135
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
136
|
+
/** The step log: one rack log row per tool call. */
|
|
137
|
+
export declare const StepLog: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
138
|
+
steps: {
|
|
139
|
+
type: PropType<readonly StepLine[]>;
|
|
140
|
+
required: true;
|
|
141
|
+
};
|
|
142
|
+
empty: {
|
|
143
|
+
type: StringConstructor;
|
|
144
|
+
default: string;
|
|
145
|
+
};
|
|
146
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
147
|
+
[key: string]: any;
|
|
148
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
149
|
+
steps: {
|
|
150
|
+
type: PropType<readonly StepLine[]>;
|
|
151
|
+
required: true;
|
|
152
|
+
};
|
|
153
|
+
empty: {
|
|
154
|
+
type: StringConstructor;
|
|
155
|
+
default: string;
|
|
156
|
+
};
|
|
157
|
+
}>> & Readonly<{}>, {
|
|
158
|
+
empty: string;
|
|
159
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
160
|
+
/** The map card. `map` returns the map; call the exposed `frame()` to draw it (a template ref). */
|
|
161
|
+
export declare const MapInset: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
162
|
+
map: {
|
|
163
|
+
type: PropType<() => MapState>;
|
|
164
|
+
required: true;
|
|
165
|
+
};
|
|
166
|
+
size: {
|
|
167
|
+
type: NumberConstructor;
|
|
168
|
+
default: number;
|
|
169
|
+
};
|
|
170
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
171
|
+
[key: string]: any;
|
|
172
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
173
|
+
map: {
|
|
174
|
+
type: PropType<() => MapState>;
|
|
175
|
+
required: true;
|
|
176
|
+
};
|
|
177
|
+
size: {
|
|
178
|
+
type: NumberConstructor;
|
|
179
|
+
default: number;
|
|
180
|
+
};
|
|
181
|
+
}>> & Readonly<{}>, {
|
|
182
|
+
size: number;
|
|
183
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/vue.js
CHANGED
|
@@ -4,6 +4,8 @@ import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch } from "vue"
|
|
|
4
4
|
import { associationsTable } from "./associations-table.js";
|
|
5
5
|
import { drivesBars } from "./drives-bars.js";
|
|
6
6
|
import { eyeInset } from "./eye-inset.js";
|
|
7
|
+
import { mapInset } from "./map-inset.js";
|
|
8
|
+
import { planLog, stepLog } from "./plan-log.js";
|
|
7
9
|
/** The behavior block, utility rows (current in pink) and drive rows. */
|
|
8
10
|
export const DrivesBars = defineComponent({
|
|
9
11
|
name: "DrivesBars",
|
|
@@ -80,3 +82,59 @@ export const EyeInset = defineComponent({
|
|
|
80
82
|
return () => h("figure", { ref: root });
|
|
81
83
|
},
|
|
82
84
|
});
|
|
85
|
+
/** The plan log: last plan, goals, thoughts and steps. `steps: false` leaves the step log out. */
|
|
86
|
+
export const PlanLog = defineComponent({
|
|
87
|
+
name: "PlanLog",
|
|
88
|
+
props: {
|
|
89
|
+
state: { type: Object, required: true },
|
|
90
|
+
steps: { type: Boolean, default: true },
|
|
91
|
+
},
|
|
92
|
+
setup(props) {
|
|
93
|
+
const root = ref(null);
|
|
94
|
+
let view = null;
|
|
95
|
+
onMounted(() => {
|
|
96
|
+
view = planLog(root.value, { steps: props.steps });
|
|
97
|
+
view.update(props.state);
|
|
98
|
+
});
|
|
99
|
+
watch(() => props.state, (s) => view?.update(s));
|
|
100
|
+
onBeforeUnmount(() => view?.dispose());
|
|
101
|
+
return () => h("div", { ref: root });
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
/** The step log: one rack log row per tool call. */
|
|
105
|
+
export const StepLog = defineComponent({
|
|
106
|
+
name: "StepLog",
|
|
107
|
+
props: {
|
|
108
|
+
steps: { type: Array, required: true },
|
|
109
|
+
empty: { type: String, default: "no steps yet." },
|
|
110
|
+
},
|
|
111
|
+
setup(props) {
|
|
112
|
+
const root = ref(null);
|
|
113
|
+
let view = null;
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
view = stepLog(root.value, { empty: props.empty });
|
|
116
|
+
view.update(props.steps);
|
|
117
|
+
});
|
|
118
|
+
watch(() => props.steps, (s) => view?.update(s));
|
|
119
|
+
onBeforeUnmount(() => view?.dispose());
|
|
120
|
+
return () => h("div", { ref: root });
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
/** The map card. `map` returns the map; call the exposed `frame()` to draw it (a template ref). */
|
|
124
|
+
export const MapInset = defineComponent({
|
|
125
|
+
name: "MapInset",
|
|
126
|
+
props: {
|
|
127
|
+
map: { type: Function, required: true },
|
|
128
|
+
size: { type: Number, default: 160 },
|
|
129
|
+
},
|
|
130
|
+
setup(props, { expose }) {
|
|
131
|
+
const root = ref(null);
|
|
132
|
+
let view = null;
|
|
133
|
+
onMounted(() => {
|
|
134
|
+
view = mapInset(root.value, { map: () => props.map(), size: props.size });
|
|
135
|
+
});
|
|
136
|
+
onBeforeUnmount(() => view?.dispose());
|
|
137
|
+
expose({ frame: () => view?.frame() });
|
|
138
|
+
return () => h("figure", { ref: root });
|
|
139
|
+
},
|
|
140
|
+
});
|