lavish-axi 0.1.6 → 0.1.8
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 +12 -11
- package/dist/cli.mjs +23 -15
- package/dist/design/tailwindcss-browser.js +25 -25
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -64,9 +64,9 @@ npm install -g lavish-axi
|
|
|
64
64
|
```sh
|
|
65
65
|
git clone https://github.com/kunchenguid/lavish-axi.git
|
|
66
66
|
cd lavish-axi
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
pnpm install --frozen-lockfile
|
|
68
|
+
pnpm run build
|
|
69
|
+
pnpm link
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
## How It Works
|
|
@@ -95,7 +95,8 @@ npm link
|
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
- **File-path identity** - Sessions are keyed by the canonical HTML file path, so agents do not need opaque IDs.
|
|
98
|
-
- **Sandboxed artifact** - The artifact runs in an iframe while Lavish injects a small SDK for annotations and
|
|
98
|
+
- **Sandboxed artifact** - The artifact runs in an iframe while Lavish injects a small SDK for annotations, snapshots, and feedback controls, plus Tailwind CSS v4 and DaisyUI v5 design assets unless the HTML includes `<meta name="lavish-design" content="off">`.
|
|
99
|
+
- **Feedback controls** - Mark buttons, choices, and other interactive elements with `data-lavish-action` so Lavish does not annotate them, then call `window.lavish.queuePrompt()` or `window.lavish.sendQueuedPrompts()` from the control handler.
|
|
99
100
|
- **Precise targets** - Text annotations include selected text plus range anchors, so agents are not limited to whole-element selectors.
|
|
100
101
|
- **Local-first state** - Session state stays under `.lavish-axi/` in the workspace.
|
|
101
102
|
|
|
@@ -110,7 +111,7 @@ npm link
|
|
|
110
111
|
| `lavish-axi playbook [id]` | List focused artifact guidance or show one playbook. |
|
|
111
112
|
| `lavish-axi design` | Show the injected Tailwind CSS and DaisyUI design reference. |
|
|
112
113
|
|
|
113
|
-
Known playbook IDs: `diagram`, `table`, `comparison`, `plan`, `diff`, `
|
|
114
|
+
Known playbook IDs: `diagram`, `table`, `comparison`, `plan`, `diff`, `input`, `slides`.
|
|
114
115
|
|
|
115
116
|
### Flags
|
|
116
117
|
|
|
@@ -123,10 +124,10 @@ Known playbook IDs: `diagram`, `table`, `comparison`, `plan`, `diff`, `interacti
|
|
|
123
124
|
## Development
|
|
124
125
|
|
|
125
126
|
```sh
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
pnpm run check # Run all verification commands
|
|
128
|
+
pnpm run build # Bundle the publishable CLI, chrome, and design assets
|
|
129
|
+
pnpm test # Run node:test tests
|
|
130
|
+
pnpm run lint # Run ESLint
|
|
131
|
+
pnpm run format:check # Check Prettier formatting
|
|
132
|
+
pnpm run typecheck # Run TypeScript checkJs validation
|
|
132
133
|
```
|
package/dist/cli.mjs
CHANGED
|
@@ -616,8 +616,8 @@ var PLAYBOOKS = [
|
|
|
616
616
|
]
|
|
617
617
|
},
|
|
618
618
|
{
|
|
619
|
-
id: "
|
|
620
|
-
use_when: "
|
|
619
|
+
id: "input",
|
|
620
|
+
use_when: "Must be used when the agent needs to collect user input on decisions, choices, preferences, triage, scope, or other structured feedback from within the artifact",
|
|
621
621
|
choose: [
|
|
622
622
|
"Use this when the user needs to select, tune, triage, annotate, or edit a structured choice.",
|
|
623
623
|
"Use controls for decisions the user can make faster visually than by writing a prompt.",
|
|
@@ -629,7 +629,10 @@ var PLAYBOOKS = [
|
|
|
629
629
|
"Show queued or selected state clearly so the user trusts what will be sent back."
|
|
630
630
|
],
|
|
631
631
|
design_rules: [
|
|
632
|
-
"
|
|
632
|
+
"Put data-lavish-action on any element that should act like a feedback control so Lavish does not annotate it and shows a pointer cursor instead.",
|
|
633
|
+
"Call window.lavish.queuePrompt(prompt, options) from the control's click, change, or submit handler to queue a precise request for the agent.",
|
|
634
|
+
"Pass options such as tag, text, selector, target, or data when they help the agent understand exactly what the user chose.",
|
|
635
|
+
"Call window.lavish.sendQueuedPrompts() when the control should immediately send the queued feedback instead of waiting for the user to press Send to Agent.",
|
|
633
636
|
"Make queued prompts specific enough that the agent can act without asking a follow-up question.",
|
|
634
637
|
"Keep native browser controls accessible and readable on mobile."
|
|
635
638
|
],
|
|
@@ -640,7 +643,9 @@ var PLAYBOOKS = [
|
|
|
640
643
|
],
|
|
641
644
|
lavish_notes: [
|
|
642
645
|
"Lavish is strongest when the artifact becomes a focused review surface and not just a static page.",
|
|
643
|
-
|
|
646
|
+
`A minimal control looks like \`<div role="button" tabindex="0" data-lavish-action onclick="window.lavish.queuePrompt('Choose option A', { tag: 'choice', text: 'Option A' })">Choose option A</div>\`.`,
|
|
647
|
+
"Use window.lavish.queuePrompt for user intent, not internal analytics or UI-only state changes.",
|
|
648
|
+
"End input paths with an obvious way for the user to send feedback back to the agent."
|
|
644
649
|
]
|
|
645
650
|
},
|
|
646
651
|
{
|
|
@@ -761,7 +766,7 @@ function createArtifactSdk() {
|
|
|
761
766
|
const text = selection.toString().trim().replace(/\s+/g, " ");
|
|
762
767
|
if (range.collapsed || !text) return null;
|
|
763
768
|
const ancestor = closestElement(range.commonAncestorContainer);
|
|
764
|
-
if (isLavishUi(ancestor)) return null;
|
|
769
|
+
if (isLavishUi(ancestor) || isLavishAction(ancestor)) return null;
|
|
765
770
|
const commonAncestorSelector = selector(ancestor);
|
|
766
771
|
const target = {
|
|
767
772
|
type: "text-range",
|
|
@@ -784,6 +789,9 @@ function createArtifactSdk() {
|
|
|
784
789
|
function isLavishUi(el) {
|
|
785
790
|
return !!(el && el.closest && el.closest("[data-lavish-ui]"));
|
|
786
791
|
}
|
|
792
|
+
function isLavishAction(el) {
|
|
793
|
+
return !!(el && el.closest && el.closest("[data-lavish-action]"));
|
|
794
|
+
}
|
|
787
795
|
function highlightElement(el) {
|
|
788
796
|
if (!el) return;
|
|
789
797
|
el.style.outline = "var(--lavish-annotate-outline,2px solid #f4c95d)";
|
|
@@ -816,7 +824,7 @@ function createArtifactSdk() {
|
|
|
816
824
|
if (annotationMode && !style) {
|
|
817
825
|
style = document.createElement("style");
|
|
818
826
|
style.id = "lavish-cursor-style";
|
|
819
|
-
style.textContent = ":root{--lavish-accent:#f4c95d;--lavish-annotate-outline:2px solid var(--lavish-accent);--lavish-annotate-offset:2px}*{cursor:default!important}";
|
|
827
|
+
style.textContent = ":root{--lavish-accent:#f4c95d;--lavish-annotate-outline:2px solid var(--lavish-accent);--lavish-annotate-offset:2px}*{cursor:default!important}[data-lavish-action],[data-lavish-action] *{cursor:pointer!important}";
|
|
820
828
|
document.head.appendChild(style);
|
|
821
829
|
}
|
|
822
830
|
if (!annotationMode && style) style.remove();
|
|
@@ -935,7 +943,7 @@ function createArtifactSdk() {
|
|
|
935
943
|
document.addEventListener(
|
|
936
944
|
"mouseover",
|
|
937
945
|
(event) => {
|
|
938
|
-
if (!annotationMode || isLavishUi(event.target)) return;
|
|
946
|
+
if (!annotationMode || isLavishUi(event.target) || isLavishAction(event.target)) return;
|
|
939
947
|
if (event.target === selected) return;
|
|
940
948
|
if (hovered && hovered !== selected) clearHighlight(hovered);
|
|
941
949
|
hovered = event.target;
|
|
@@ -956,7 +964,7 @@ function createArtifactSdk() {
|
|
|
956
964
|
document.addEventListener(
|
|
957
965
|
"mouseup",
|
|
958
966
|
(event) => {
|
|
959
|
-
if (!annotationMode || isLavishUi(event.target)) return;
|
|
967
|
+
if (!annotationMode || isLavishUi(event.target) || isLavishAction(event.target)) return;
|
|
960
968
|
const c = textSelectionContext(document.getSelection());
|
|
961
969
|
if (!c) return;
|
|
962
970
|
ignoreNextClick = true;
|
|
@@ -967,7 +975,7 @@ function createArtifactSdk() {
|
|
|
967
975
|
document.addEventListener(
|
|
968
976
|
"click",
|
|
969
977
|
(event) => {
|
|
970
|
-
if (!annotationMode || isLavishUi(event.target)) return;
|
|
978
|
+
if (!annotationMode || isLavishUi(event.target) || isLavishAction(event.target)) return;
|
|
971
979
|
event.preventDefault();
|
|
972
980
|
event.stopPropagation();
|
|
973
981
|
if (ignoreNextClick) {
|
|
@@ -1708,8 +1716,8 @@ function normalizePagePath(path5) {
|
|
|
1708
1716
|
|
|
1709
1717
|
// src/cli.js
|
|
1710
1718
|
var COMMANDS = /* @__PURE__ */ new Set(["open", "poll", "end", "server", "playbook", "design"]);
|
|
1711
|
-
var DESCRIPTION = "Lavish Editor helps agents turn rich HTML artifacts into collaborative human review surfaces. First generate an interactive HTML artifact according to user request, then run `lavish-axi <html-file>` so the user can visually review it, annotate elements or selected text, queue prompts, and send feedback back through `lavish-axi poll`.";
|
|
1712
|
-
var VERSION = "0.1.
|
|
1719
|
+
var DESCRIPTION = "Lavish Editor helps agents turn rich HTML artifacts into collaborative human review surfaces. Whenever you are about to give user a complex response that will be easier to understand via a rich / interactive page, consider using Lavish Editor. First generate an interactive HTML artifact according to user request, then run `lavish-axi <html-file>` so the user can visually review it, annotate elements or selected text, queue prompts, and send feedback back through `lavish-axi poll`.";
|
|
1720
|
+
var VERSION = "0.1.8";
|
|
1713
1721
|
async function run(argv) {
|
|
1714
1722
|
await ensureStateDir();
|
|
1715
1723
|
const normalizedArgv = normalizeArgv(argv);
|
|
@@ -1793,7 +1801,7 @@ function createHomeOutput({ bin, sessions, includeSessions = true }) {
|
|
|
1793
1801
|
"Use visual hierarchy to make the most important decisions, risks, tradeoffs, and next actions obvious at a glance",
|
|
1794
1802
|
"Use visual structure such as sections, cards, tables, diagrams, annotated snippets, and side-by-side comparisons instead of long prose",
|
|
1795
1803
|
"Choose typography, spacing, color, and layout deliberately so the artifact has a clear point of view",
|
|
1796
|
-
"
|
|
1804
|
+
"Prevent horizontal overflow: design narrow layouts intentionally, use minmax(0, 1fr) and min-width: 0 for grid/flex children, and deliberately wrap or truncate long labels/status text"
|
|
1797
1805
|
],
|
|
1798
1806
|
playbooks: listPlaybooks(),
|
|
1799
1807
|
help: [
|
|
@@ -1826,7 +1834,7 @@ function createPlaybookOutput(args) {
|
|
|
1826
1834
|
function createOpenOutput({ file, url, status }) {
|
|
1827
1835
|
return {
|
|
1828
1836
|
session: { file, url, status },
|
|
1829
|
-
next_step: `
|
|
1837
|
+
next_step: `Run \`lavish-axi poll ${file}\`. This command long-polls until the user sends feedback or ends the session. Do not pass --timeout-ms during normal agent use. Do not set a short shell timeout; either run it without a timeout or set the shell timeout above 10 minutes. After applying feedback, run \`lavish-axi poll ${file} --agent-reply "<message for the user>"\` without --timeout-ms to show your response in Lavish Editor and wait for more feedback.`
|
|
1830
1838
|
};
|
|
1831
1839
|
}
|
|
1832
1840
|
async function openCommand(args) {
|
|
@@ -2094,12 +2102,12 @@ End a Lavish Editor session.
|
|
|
2094
2102
|
`,
|
|
2095
2103
|
playbook: `Usage: lavish-axi playbook [playbook_id]
|
|
2096
2104
|
|
|
2097
|
-
List focused artifact guidance playbooks, or show one playbook by ID. Known IDs: diagram, table, comparison, plan, diff,
|
|
2105
|
+
List focused artifact guidance playbooks, or show one playbook by ID. Known IDs: diagram, table, comparison, plan, diff, input, slides.
|
|
2098
2106
|
|
|
2099
2107
|
Examples:
|
|
2100
2108
|
lavish-axi playbook
|
|
2101
2109
|
lavish-axi playbook diagram
|
|
2102
|
-
lavish-axi playbook
|
|
2110
|
+
lavish-axi playbook input
|
|
2103
2111
|
`,
|
|
2104
2112
|
design: `Usage: lavish-axi design
|
|
2105
2113
|
|