pointery 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pointery
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,83 @@
1
- # Temporary Holding Version
1
+ # Pointery — ask anything in-app, get taken there.
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Drop-in kit for any SaaS. User presses Shift+A (or Cmd+K), types
4
+ "where is export?" or "how do I invite a teammate?", and Pointery
5
+ highlights the button, navigates to the right page, and walks them
6
+ step-by-step.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm i pointery
12
+ npx pointery init
13
+ ```
14
+
15
+ `init` drops `pointery.context.json` (starter map) and
16
+ `pointery.config.json` (theme/shortcut). It never overwrites
17
+ without `--force`. `npx pointery init --check` validates that
18
+ every guide step points at a real target.
19
+
20
+ ## Wire up (10 lines)
21
+
22
+ ```tsx
23
+ // layout.tsx — mount once, next to {children}
24
+ import { Pointery } from "pointery";
25
+ import "pointery/styles.css";
26
+
27
+ <Pointery />;
28
+ ```
29
+
30
+ ```ts
31
+ // app/api/ask/route.ts — your endpoint, your key, your data
32
+ import { createAskHandler, type PointeryContext } from "pointery";
33
+ import context from "@/pointery.context.json";
34
+
35
+ export const POST = createAskHandler(context as PointeryContext);
36
+ ```
37
+
38
+ ```tsx
39
+ // optional: real side-effects for actions
40
+ <Pointery onAction={async (name) => { /* your logic */ }} />;
41
+ ```
42
+
43
+ Without `onAction`, actions just log to localStorage, fire a
44
+ `pointery:action` window event, and toast. Your data never leaves
45
+ your app.
46
+
47
+ ## The 3 parts
48
+
49
+ 1. **UI (this package):** `<Pointery/>` palette, toast, pulse on
50
+ `data-pointery="..."` elements, guide walk, allowlisted actions.
51
+ 2. **Map (`pointery.context.json`, yours):** `{ targets, guides,
52
+ actions, answers }`. Built by your coding agent running our
53
+ prompt (`POINTERY_PROMPT.md`), not by us.
54
+ 3. **Brain (your key):** pass `llm: { url, key }` to
55
+ `createAskHandler` to forward `{ query, context }` to your own
56
+ model endpoint. Otherwise the bundled keyword resolver answers
57
+ locally. No calls to us, no data to us.
58
+
59
+ ## Props
60
+
61
+ | Prop | Default | What |
62
+ | ---- | ------- | ---- |
63
+ | `trigger` | `"shift+a"` | Shortcut (Cmd/Ctrl+K always works too) |
64
+ | `theme` | `{ primary: "#6d28d9", radius: 14 }` | Applied as `--pointery-*` CSS vars |
65
+ | `position` | `"top"` | `"top"` / `"center"` / `"bottom"` |
66
+ | `suggestions` | built-in 5 | Buttons shown before typing |
67
+ | `allowActions` | `["mark-won", …]` | Actions the UI will run |
68
+ | `labels` | english | `placeholder`, `empty`, `confirmTitle` |
69
+ | `endpoint` | `"/api/ask"` | Where queries are POSTed |
70
+ | `onAction` | log + toast | `(name) => void \| Promise<void>` |
71
+
72
+ White-label further with `--pointery-*` CSS vars.
73
+
74
+ ## Validate your map
75
+
76
+ ```ts
77
+ import { validateContext } from "pointery";
78
+ const errors = validateContext(context); // [] = valid
79
+ ```
80
+
81
+ ## License
82
+
83
+ MIT.
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+ // `npx pointery init` — drop starter files into the consumer's app.
3
+ // Zero dependencies. Never overwrites without --force.
4
+ import fs from "fs";
5
+ import path from "path";
6
+
7
+ const args = process.argv.slice(2);
8
+ const cmd = args[0];
9
+ const force = args.includes("--force");
10
+ const check = args.includes("--check");
11
+ const cwd = process.cwd();
12
+
13
+ const STARTER_CONTEXT = {
14
+ version: 1,
15
+ targets: [
16
+ {
17
+ key: "export-button",
18
+ page: "/dashboard",
19
+ hint: "Export — downloads the report as CSV",
20
+ keywords: ["export", "csv", "download", "where is export"],
21
+ },
22
+ ],
23
+ guides: [
24
+ {
25
+ id: "export-report",
26
+ title: "Export your report",
27
+ keywords: ["export", "csv", "download", "report"],
28
+ steps: [
29
+ { text: "Open the Dashboard", go: "/dashboard", spot: "export-button" },
30
+ { text: "Click “Export” (top right)", go: "/dashboard", spot: "export-button" },
31
+ ],
32
+ },
33
+ ],
34
+ answers: [],
35
+ actions: [
36
+ { name: "export-report", label: "Export report CSV", confirm: false, keywords: ["export", "download csv"] },
37
+ ],
38
+ };
39
+
40
+ const STARTER_CONFIG = {
41
+ trigger: "shift+a",
42
+ theme: { primary: "#6d28d9", radius: 14 },
43
+ position: "top",
44
+ suggestions: ["Where is export?"],
45
+ allowActions: ["export-report"],
46
+ };
47
+
48
+ const SNIPPET = `import { Pointery } from "pointery";
49
+ import "pointery/styles.css";
50
+
51
+ // once in your root layout, next to {children}:
52
+ <Pointery />
53
+ // API route (app/api/ask/route.ts):
54
+ // import { createAskHandler } from "pointery";
55
+ // import context from "@/pointery.context.json";
56
+ // export const POST = createAskHandler(context);`;
57
+
58
+ function write(name, data) {
59
+ const p = path.join(cwd, name);
60
+ if (fs.existsSync(p) && !force) {
61
+ console.log(`skip ${name} (exists — use --force to overwrite)`);
62
+ return;
63
+ }
64
+ fs.writeFileSync(p, typeof data === "string" ? data : JSON.stringify(data, null, 2) + "\n");
65
+ console.log(`wrote ${name}`);
66
+ }
67
+
68
+ if (cmd === "init") {
69
+ write("pointery.context.json", STARTER_CONTEXT);
70
+ write("pointery.config.json", STARTER_CONFIG);
71
+ console.log("\nNext: paste POINTERY_PROMPT.md into your coding agent to map your UI,");
72
+ console.log("then mount <Pointery/> once in layout.tsx:\n\n" + SNIPPET);
73
+
74
+ if (check) {
75
+ const ctx = JSON.parse(fs.readFileSync(path.join(cwd, "pointery.context.json"), "utf8"));
76
+ const problems = [];
77
+ const keys = new Set((ctx.targets || []).map((t) => t.key));
78
+ (ctx.guides || []).forEach((g, i) =>
79
+ (g.steps || []).forEach((s) => {
80
+ if (s.spot && !keys.has(s.spot)) problems.push(`guides[${i}]: spot "${s.spot}" matches no target`);
81
+ })
82
+ );
83
+ console.log(problems.length ? "\ncheck failed:\n- " + problems.join("\n- ") : "\ncheck ok");
84
+ process.exit(problems.length ? 1 : 0);
85
+ }
86
+ } else {
87
+ console.log("Usage: npx pointery init [--force] [--check]");
88
+ process.exit(cmd ? 1 : 0);
89
+ }
@@ -0,0 +1,4 @@
1
+ import type { PointeryProps } from "./types.js";
2
+ export declare function pulse(key: string): void;
3
+ export default function Pointery(props: PointeryProps): import("react").JSX.Element;
4
+ //# sourceMappingURL=Pointery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pointery.d.ts","sourceRoot":"","sources":["../src/Pointery.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,YAAY,CAAC;AAgBhE,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,QAWhC;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,aAAa,+BA0KpD"}
@@ -0,0 +1,165 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useCallback, useEffect, useRef, useState } from "react";
4
+ import { useRouter } from "next/navigation";
5
+ import { getSuggestions } from "./resolver.js";
6
+ const DEFAULTS = {
7
+ trigger: "shift+a",
8
+ theme: { primary: "#6d28d9", radius: 14 },
9
+ position: "top",
10
+ suggestions: getSuggestions(),
11
+ allowActions: ["mark-won", "invite-teammate", "export-pipeline"],
12
+ labels: { placeholder: 'Ask "where is export?" or "how do I invite?"', empty: "No match — try “export”, “invite”, or “pipeline”.", confirmTitle: "Run this action?" },
13
+ endpoint: "/api/ask",
14
+ };
15
+ export function pulse(key) {
16
+ requestAnimationFrame(() => {
17
+ const el = document.querySelector(`[data-pointery="${key}"]`);
18
+ if (!el)
19
+ return;
20
+ el.scrollIntoView({ behavior: "smooth", block: "center" });
21
+ el.classList.remove("pointery-pulse");
22
+ // restart animation
23
+ void el.offsetWidth;
24
+ el.classList.add("pointery-pulse");
25
+ window.setTimeout(() => el.classList.remove("pointery-pulse"), 2600);
26
+ });
27
+ }
28
+ export default function Pointery(props) {
29
+ var _a, _b;
30
+ const cfg = Object.assign(Object.assign(Object.assign({}, DEFAULTS), props), { theme: Object.assign(Object.assign({}, DEFAULTS.theme), props.theme), labels: Object.assign(Object.assign({}, DEFAULTS.labels), props.labels) });
31
+ const [open, setOpen] = useState(false);
32
+ const [q, setQ] = useState("");
33
+ const [loading, setLoading] = useState(false);
34
+ const [res, setRes] = useState(null);
35
+ const [toast, setToast] = useState(null);
36
+ const [guide, setGuide] = useState(null);
37
+ const [pendingAction, setPendingAction] = useState(null);
38
+ const [guideIdx, setGuideIdx] = useState(0);
39
+ const router = useRouter();
40
+ const inputRef = useRef(null);
41
+ const toastTimer = useRef(null);
42
+ const say = useCallback((text) => {
43
+ if (toastTimer.current)
44
+ window.clearTimeout(toastTimer.current);
45
+ setToast({ id: Date.now(), text });
46
+ toastTimer.current = window.setTimeout(() => setToast(null), 4200);
47
+ }, []);
48
+ // apply theme vars
49
+ useEffect(() => {
50
+ const root = document.documentElement;
51
+ if (cfg.theme.primary)
52
+ root.style.setProperty("--pointery-primary", cfg.theme.primary);
53
+ if (cfg.theme.radius != null)
54
+ root.style.setProperty("--pointery-radius", `${cfg.theme.radius}px`);
55
+ }, [cfg.theme.primary, cfg.theme.radius]);
56
+ // trigger: Shift+A + Cmd/Ctrl+K always
57
+ useEffect(() => {
58
+ const onKey = (e) => {
59
+ var _a;
60
+ const tag = (_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName;
61
+ if (tag === "INPUT" && open)
62
+ return; // let them type
63
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
64
+ e.preventDefault();
65
+ setOpen((v) => !v);
66
+ return;
67
+ }
68
+ if (e.shiftKey && e.key.toLowerCase() === "a" && !e.metaKey && !e.ctrlKey) {
69
+ e.preventDefault();
70
+ setOpen((v) => !v);
71
+ }
72
+ if (e.key === "Escape") {
73
+ setOpen(false);
74
+ setGuide(null);
75
+ setPendingAction(null);
76
+ }
77
+ };
78
+ window.addEventListener("keydown", onKey);
79
+ return () => window.removeEventListener("keydown", onKey);
80
+ }, [open]);
81
+ useEffect(() => { if (open)
82
+ setTimeout(() => { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, 30); }, [open]);
83
+ // Default action behavior: log + event + toast. Consumers override
84
+ // via onAction for real side-effects (their data stays theirs).
85
+ const runAction = useCallback(async (name) => {
86
+ var _a;
87
+ if (props.onAction)
88
+ return props.onAction(name);
89
+ try {
90
+ const log = JSON.parse((_a = localStorage.getItem("pointery-actions")) !== null && _a !== void 0 ? _a : "[]");
91
+ log.push({ name, at: Date.now() });
92
+ localStorage.setItem("pointery-actions", JSON.stringify(log));
93
+ }
94
+ catch ( /* storage unavailable — event still fires */_b) { /* storage unavailable — event still fires */ }
95
+ window.dispatchEvent(new CustomEvent("pointery:action", { detail: name }));
96
+ say(`Done — ${name}.`);
97
+ }, [props, say]);
98
+ const goSpot = useCallback((go, spot, hint) => {
99
+ if (go)
100
+ router.push(go);
101
+ if (spot)
102
+ setTimeout(() => pulse(spot), go ? 450 : 50);
103
+ if (hint)
104
+ say(hint);
105
+ }, [router, say]);
106
+ const ask = useCallback(async (query) => {
107
+ const queryText = query.trim();
108
+ if (!queryText)
109
+ return;
110
+ setLoading(true);
111
+ try {
112
+ const r = await fetch(cfg.endpoint, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ query: queryText }) });
113
+ const data = (await r.json());
114
+ setRes(data);
115
+ if (data.answer)
116
+ say(data.answer);
117
+ if (data.guide) {
118
+ setGuide({ title: data.guide.title, steps: data.guide.steps, i: 0 });
119
+ setGuideIdx(0);
120
+ }
121
+ if (data.action && !cfg.allowActions.includes(data.action)) {
122
+ say(`Action “${data.action}” is not allowlisted.`);
123
+ return;
124
+ }
125
+ if (data.action) {
126
+ if (data.confirm === false) {
127
+ setOpen(false);
128
+ await runAction(data.action);
129
+ }
130
+ else
131
+ setPendingAction(data.action);
132
+ }
133
+ else if (data.go || data.spot)
134
+ goSpot(data.go, data.spot, data.hint);
135
+ else if (!data.answer && !data.guide)
136
+ say(cfg.labels.empty);
137
+ }
138
+ catch (_a) {
139
+ say(`Pointery is unreachable — is ${cfg.endpoint} mounted?`);
140
+ }
141
+ finally {
142
+ setLoading(false);
143
+ }
144
+ }, [cfg.allowActions, cfg.labels.empty, cfg.endpoint, goSpot, runAction, say]);
145
+ const startGuide = (g) => {
146
+ const s = g.steps[guideIdx];
147
+ if (s)
148
+ goSpot(s.go, s.spot, `${g.title} — step ${guideIdx + 1}/${g.steps.length}: ${s.text}`);
149
+ };
150
+ if (!open && !guide && !toast && !pendingAction) {
151
+ return (_jsx("button", { onClick: () => setOpen(true), "aria-label": "Ask Pointery", className: "pointery-fab", title: "Ask Pointery (Shift+A)", children: "?" }));
152
+ }
153
+ const pos = cfg.position === "center" ? "items-center" : cfg.position === "bottom" ? "items-end pb-16" : "items-start pt-16";
154
+ return (_jsxs(_Fragment, { children: [toast && (_jsx("div", { className: "pointery-toast", role: "status", children: toast.text })), guide && (_jsxs("div", { className: "pointery-guide", role: "dialog", "aria-label": guide.title, children: [_jsxs("div", { className: "pointery-guide-title", children: [guide.title, " ", _jsxs("span", { children: ["\u00B7 ", guideIdx + 1, "/", guide.steps.length] })] }), _jsx("p", { className: "pointery-guide-step", children: (_a = guide.steps[guideIdx]) === null || _a === void 0 ? void 0 : _a.text }), _jsxs("div", { className: "pointery-guide-row", children: [_jsx("button", { disabled: guideIdx === 0, onClick: () => { const n = guideIdx - 1; setGuideIdx(n); const s = guide.steps[n]; goSpot(s.go, s.spot); }, children: "Back" }), guideIdx < guide.steps.length - 1
155
+ ? _jsx("button", { className: "primary", onClick: () => { const n = guideIdx + 1; setGuideIdx(n); const s = guide.steps[n]; goSpot(s.go, s.spot, s.text); }, children: "Next" })
156
+ : _jsx("button", { className: "primary", onClick: () => { setGuide(null); say("Guide complete."); }, children: "Done" }), _jsx("button", { onClick: () => setGuide(null), "aria-label": "Close guide", children: "\u2715" })] })] })), pendingAction && (_jsxs("div", { className: "pointery-confirm", role: "alertdialog", "aria-label": cfg.labels.confirmTitle, children: [_jsxs("p", { children: [_jsx("strong", { children: cfg.labels.confirmTitle }), _jsx("br", {}), "\u201C", pendingAction, "\u201D \u2014 destructive actions need your OK."] }), _jsxs("div", { className: "pointery-guide-row", children: [_jsx("button", { onClick: () => setPendingAction(null), children: "Cancel" }), _jsx("button", { className: "primary", onClick: async () => { const a = pendingAction; setPendingAction(null); setOpen(false); await runAction(a); }, children: "Confirm" })] })] })), open && (_jsx("div", { className: `pointery-overlay ${pos}`, onClick: () => setOpen(false), children: _jsxs("div", { className: "pointery-palette", onClick: (e) => e.stopPropagation(), role: "dialog", "aria-label": "Ask Pointery", children: [_jsx("form", { onSubmit: (e) => { e.preventDefault(); ask(q); }, children: _jsx("input", { ref: inputRef, value: q, onChange: (e) => { setQ(e.target.value); setRes(null); setPendingAction(null); }, placeholder: cfg.labels.placeholder, "aria-label": "Ask Pointery" }) }), loading && _jsx("p", { className: "pointery-meta", children: "Thinking\u2026" }), !q && (_jsx("div", { className: "pointery-suggest", children: ((_b = cfg.suggestions) !== null && _b !== void 0 ? _b : []).map((s) => (_jsx("button", { onClick: () => { setQ(s); ask(s); }, children: s }, s))) })), res && (res.go || res.spot || res.action || res.guide) && (_jsxs("div", { className: "pointery-result", children: [res.hint && _jsx("p", { children: _jsx("strong", { children: res.hint }) }), _jsxs("div", { className: "pointery-guide-row", children: [(res.go || res.spot) && _jsx("button", { className: "primary", onClick: () => { goSpot(res.go, res.spot, res.hint); setOpen(false); }, children: "Take me there" }), res.guide && _jsx("button", { className: "primary", onClick: () => { setGuideIdx(0); startGuide({ title: res.guide.title, steps: res.guide.steps, i: 0 }); setOpen(false); }, children: "Start guide" }), res.action && _jsx("button", { className: "primary", onClick: async () => { const a = res.action; if (res.confirm) {
157
+ setOpen(false);
158
+ setPendingAction(a);
159
+ }
160
+ else {
161
+ setOpen(false);
162
+ await runAction(a);
163
+ } }, children: "Run action" })] })] })), _jsx("p", { className: "pointery-meta", children: "Shift+A toggles \u00B7 \u2318K works too \u00B7 Esc closes" })] }) }))] }));
164
+ }
165
+ //# sourceMappingURL=Pointery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pointery.js","sourceRoot":"","sources":["../src/Pointery.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAK/C,MAAM,QAAQ,GAAG;IACf,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE;IACzC,QAAQ,EA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AAS,EAAC,OAAO,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,GAAG,CAAC,MAAO,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;gDAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gDAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;4CAAC,CAAC;iDAAM,CAAC;gDAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gDAAC,MAAM,SAAS,CAAC,CAAC,CAAC,CAAC;4CAAC,CAAC,CAAC,CAAC,2BAAqB,IAClN,IACF,CACP,EACD,YAAG,SAAS,EAAC,eAAe,2EAAgD,IACxE,GACF,CACP,IACA,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { default as Pointery, pulse } from "./Pointery.js";
2
+ export { resolveQuery, getSuggestions } from "./resolver.js";
3
+ export { createAskHandler } from "./server.js";
4
+ export { validateContext } from "./validate.js";
5
+ export type { PointeryProps, PointeryResult, PointeryContext, PointerySpot, PointeryGuide, PointeryGuideStep, PointeryAction, PointeryTheme, PointeryPosition, PointeryLabels, PointeryLLMAdapter, AskHandlerOptions, } from "./types.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EACV,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { default as Pointery, pulse } from "./Pointery.js";
2
+ export { resolveQuery, getSuggestions } from "./resolver.js";
3
+ export { createAskHandler } from "./server.js";
4
+ export { validateContext } from "./validate.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { PointeryContext, PointeryResult } from "./types.js";
2
+ export declare function resolveQuery(query: string, context: PointeryContext): PointeryResult;
3
+ export declare function getSuggestions(): string[];
4
+ //# sourceMappingURL=resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA0BlE,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,cAAc,CA0DpF;AAED,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAQzC"}
@@ -0,0 +1,101 @@
1
+ const norm = (s) => s.toLowerCase().trim();
2
+ const score = (q, keywords) => {
3
+ const query = norm(q);
4
+ let best = 0;
5
+ for (const k of keywords) {
6
+ const key = norm(k);
7
+ if (!key)
8
+ continue;
9
+ if (query === key)
10
+ return 100 + key.length;
11
+ if (query.includes(key) || key.includes(query))
12
+ best = Math.max(best, 10 + key.length);
13
+ }
14
+ // word overlap fallback
15
+ const words = query.split(/\s+/);
16
+ for (const k of keywords) {
17
+ const key = norm(k);
18
+ const hit = words.filter((w) => w.length > 2 && key.includes(w)).length;
19
+ if (hit > 0)
20
+ best = Math.max(best, hit);
21
+ }
22
+ return best;
23
+ };
24
+ export function resolveQuery(query, context) {
25
+ var _a, _b, _c, _d, _e, _f;
26
+ const targets = (_a = context.targets) !== null && _a !== void 0 ? _a : [];
27
+ const guides = (_b = context.guides) !== null && _b !== void 0 ? _b : [];
28
+ const actions = (_c = context.actions) !== null && _c !== void 0 ? _c : [];
29
+ const q = norm(query);
30
+ if (!q)
31
+ return {};
32
+ // Direct answers come from the consumer's context — never hardcoded here.
33
+ if (context.answers) {
34
+ let best = null;
35
+ let bestScore = 0;
36
+ for (const a of context.answers) {
37
+ const s = score(q, a.keywords);
38
+ if (s > bestScore) {
39
+ bestScore = s;
40
+ best = a;
41
+ }
42
+ }
43
+ if (best && bestScore >= 10) {
44
+ return { answer: best.answer, spot: best.spot, go: best.go, hint: best.hint };
45
+ }
46
+ }
47
+ let bestGuide = null;
48
+ let bestGuideScore = 0;
49
+ for (const g of guides) {
50
+ const s = score(q, [g.title, g.id.replace(/-/g, " "), ...g.keywords]);
51
+ if (s > bestGuideScore) {
52
+ bestGuideScore = s;
53
+ bestGuide = g;
54
+ }
55
+ }
56
+ let bestTarget = null;
57
+ let bestTargetScore = 0;
58
+ for (const t of targets) {
59
+ const s = score(q, [t.key.replace(/-/g, " "), t.hint, ...t.keywords]);
60
+ if (s > bestTargetScore) {
61
+ bestTargetScore = s;
62
+ bestTarget = t;
63
+ }
64
+ }
65
+ let bestAction = null;
66
+ let bestActionScore = 0;
67
+ for (const a of actions) {
68
+ const s = score(q, [a.name.replace(/-/g, " "), (_d = a.label) !== null && _d !== void 0 ? _d : "", ...a.keywords]);
69
+ if (s > bestActionScore) {
70
+ bestActionScore = s;
71
+ bestAction = a;
72
+ }
73
+ }
74
+ // "how do I …" prefers a guide; short "export"/"invite" prefers target+action
75
+ const wantsGuide = /^(how|where|show me|walk|guide|steps)/.test(q) || bestGuideScore >= 12;
76
+ if (bestGuide && wantsGuide && bestGuideScore >= Math.max(6, bestTargetScore - 4)) {
77
+ const first = bestGuide.steps[0];
78
+ return {
79
+ guide: { id: bestGuide.id, title: bestGuide.title, steps: bestGuide.steps },
80
+ spot: first === null || first === void 0 ? void 0 : first.spot, go: first === null || first === void 0 ? void 0 : first.go, hint: bestGuide.title,
81
+ };
82
+ }
83
+ if (bestAction && bestActionScore >= 12 && bestActionScore >= bestTargetScore) {
84
+ const spot = (_e = targets.find((t) => norm(t.hint).includes(bestAction.name.replace(/-/g, " ").split(" ")[0]))) === null || _e === void 0 ? void 0 : _e.key;
85
+ return { action: bestAction.name, confirm: bestAction.confirm, spot, hint: (_f = bestAction.label) !== null && _f !== void 0 ? _f : bestAction.name };
86
+ }
87
+ if (bestTarget && bestTargetScore > 0) {
88
+ return { spot: bestTarget.key, go: bestTarget.page, hint: bestTarget.hint };
89
+ }
90
+ return {};
91
+ }
92
+ export function getSuggestions() {
93
+ return [
94
+ "Where is export?",
95
+ "How do I invite a teammate?",
96
+ "What is my pipeline worth?",
97
+ "Take me to the Acme deal",
98
+ "Walk me through closing a deal",
99
+ ];
100
+ }
101
+ //# sourceMappingURL=resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAMA,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;AACnD,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,QAAkB,EAAE,EAAE;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI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AE,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,KAAK;SACxD,CAAC;IACJ,CAAC;IACD,IAAI,UAAU,IAAI,eAAe,IAAI,EAAE,IAAI,eAAe,IAAI,eAAe,EAAE,CAAC;QAC9E,MAAM,IAAI,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,0CAAE,GAAG,CAAC;QAChH,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAA,UAAU,CAAC,KAAK,mCAAI,UAAU,CAAC,IAAI,EAAE,CAAC;IACnH,CAAC;IACD,IAAI,UAAU,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,GAAG,EAAE,EAAE,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC;IAC9E,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,kBAAkB;QAClB,6BAA6B;QAC7B,4BAA4B;QAC5B,0BAA0B;QAC1B,gCAAgC;KACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { AskHandlerOptions, PointeryContext } from "./types.js";
2
+ /**
3
+ * Build a `POST(req)` handler for the consumer's `/api/ask` route.
4
+ * Uses the bundled keyword resolver; when `opts.llm` is set, forwards
5
+ * `{ query, context }` to the customer's own model endpoint first
6
+ * (their key, their cost — nothing comes to us) and falls back locally.
7
+ *
8
+ * ```ts
9
+ * // app/api/ask/route.ts
10
+ * import { createAskHandler, type PointeryContext } from "pointery";
11
+ * import context from "@/pointery.context.json";
12
+ * export const POST = createAskHandler(context as PointeryContext);
13
+ * ```
14
+ */
15
+ export declare function createAskHandler(context: PointeryContext, opts?: AskHandlerOptions): (req: Request) => Promise<Response>;
16
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAkB,MAAM,YAAY,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,GAAE,iBAAsB,IAC1D,KAAK,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAwB5D"}
package/dist/server.js ADDED
@@ -0,0 +1,39 @@
1
+ import { resolveQuery } from "./resolver.js";
2
+ /**
3
+ * Build a `POST(req)` handler for the consumer's `/api/ask` route.
4
+ * Uses the bundled keyword resolver; when `opts.llm` is set, forwards
5
+ * `{ query, context }` to the customer's own model endpoint first
6
+ * (their key, their cost — nothing comes to us) and falls back locally.
7
+ *
8
+ * ```ts
9
+ * // app/api/ask/route.ts
10
+ * import { createAskHandler, type PointeryContext } from "pointery";
11
+ * import context from "@/pointery.context.json";
12
+ * export const POST = createAskHandler(context as PointeryContext);
13
+ * ```
14
+ */
15
+ export function createAskHandler(context, opts = {}) {
16
+ return async function POST(req) {
17
+ var _a, _b, _c;
18
+ const body = await req.json().catch(() => ({}));
19
+ const query = typeof body.query === "string" ? body.query : "";
20
+ if ((_a = opts.llm) === null || _a === void 0 ? void 0 : _a.url) {
21
+ try {
22
+ const r = await fetch(opts.llm.url, {
23
+ method: "POST",
24
+ headers: Object.assign({ "content-type": "application/json" }, (opts.llm.key ? { authorization: `Bearer ${opts.llm.key}` } : {})),
25
+ body: JSON.stringify({ query, context }),
26
+ });
27
+ if (r.ok)
28
+ return Response.json(await r.json());
29
+ }
30
+ catch (_d) {
31
+ // fall through to local resolver
32
+ }
33
+ }
34
+ const local = resolveQuery(query, context);
35
+ const override = (_c = (_b = opts.guard) === null || _b === void 0 ? void 0 : _b.call(opts, query, local)) !== null && _c !== void 0 ? _c : null;
36
+ return Response.json(override !== null && override !== void 0 ? override : local);
37
+ };
38
+ }
39
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAwB,EAAE,OAA0B,EAAE;IACrF,OAAO,KAAK,UAAU,IAAI,CAAC,GAAY;;QACrC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAA8B,CAAA,CAAC,CAAC;QAC3E,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QAE/D,IAAI,MAAA,IAAI,CAAC,GAAG,0CAAE,GAAG,EAAE,CAAC;YAClB,IAAI,CAAC;gBACH,MAAM,CAAC,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;oBAClC,MAAM,EAAE,MAAM;oBACd,OAAO,kBACL,cAAc,EAAE,kBAAkB,IAC/B,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACrE;oBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;iBACzC,CAAC,CAAC;gBACH,IAAI,CAAC,CAAC,EAAE;oBAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACjD,CAAC;YAAC,WAAM,CAAC;gBACP,iCAAiC;YACnC,CAAC;QACH,CAAC;QAED,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAA0B,MAAA,MAAA,IAAI,CAAC,KAAK,qDAAG,KAAK,EAAE,KAAK,CAAC,mCAAI,IAAI,CAAC;QAC3E,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,94 @@
1
+ export type PointerySpot = {
2
+ key: string;
3
+ page: string;
4
+ hint: string;
5
+ };
6
+ export type PointeryGuideStep = {
7
+ text: string;
8
+ go: string;
9
+ spot: string;
10
+ };
11
+ export type PointeryGuide = {
12
+ id: string;
13
+ title: string;
14
+ steps: PointeryGuideStep[];
15
+ };
16
+ export type PointeryAction = {
17
+ name: string;
18
+ label?: string;
19
+ confirm?: boolean;
20
+ };
21
+ export type PointeryContext = {
22
+ targets: {
23
+ key: string;
24
+ page: string;
25
+ hint: string;
26
+ keywords: string[];
27
+ }[];
28
+ guides: {
29
+ id: string;
30
+ title: string;
31
+ keywords: string[];
32
+ steps: {
33
+ text: string;
34
+ go: string;
35
+ spot: string;
36
+ }[];
37
+ }[];
38
+ actions: {
39
+ name: string;
40
+ label?: string;
41
+ confirm?: boolean;
42
+ keywords: string[];
43
+ }[];
44
+ answers?: {
45
+ keywords: string[];
46
+ answer: string;
47
+ spot?: string;
48
+ go?: string;
49
+ hint?: string;
50
+ }[];
51
+ };
52
+ export type PointeryResult = {
53
+ spot?: string;
54
+ go?: string;
55
+ action?: string;
56
+ /** Echoed from the matched action's `confirm` flag — UI confirms only when true. */
57
+ confirm?: boolean;
58
+ answer?: string;
59
+ guide?: PointeryGuide;
60
+ hint?: string;
61
+ };
62
+ export type PointeryTheme = {
63
+ primary?: string;
64
+ radius?: number;
65
+ };
66
+ export type PointeryPosition = "top" | "center" | "bottom";
67
+ export type PointeryLabels = {
68
+ placeholder?: string;
69
+ empty?: string;
70
+ confirmTitle?: string;
71
+ };
72
+ export type PointeryProps = {
73
+ trigger?: string;
74
+ theme?: PointeryTheme;
75
+ position?: PointeryPosition;
76
+ suggestions?: string[];
77
+ allowActions?: string[];
78
+ labels?: PointeryLabels;
79
+ /** POST endpoint for queries. Defaults to "/api/ask". */
80
+ endpoint?: string;
81
+ /** Override default action behavior (dispatches `pointery:action` + toast otherwise). */
82
+ onAction?: (name: string) => void | Promise<void>;
83
+ };
84
+ /** Customer's own LLM endpoint. Pointery forwards { query, context } — key and cost are theirs. */
85
+ export type PointeryLLMAdapter = {
86
+ url: string;
87
+ key?: string;
88
+ };
89
+ export type AskHandlerOptions = {
90
+ llm?: PointeryLLMAdapter;
91
+ /** Return a result to short-circuit (e.g. block demo routes in prod), or null to continue. */
92
+ guard?: (query: string, local: PointeryResult) => PointeryResult | null;
93
+ };
94
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3E,MAAM,MAAM,aAAa,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,iBAAiB,EAAE,CAA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+1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { PointeryContext } from "./types.js";
2
+ /**
3
+ * Check a `pointery.context.json` for the mistakes agents commonly make:
4
+ * missing fields, duplicate keys, guide steps pointing at ids that don't exist.
5
+ * Returns human-readable errors (empty = valid). Used by `npx pointery init --check`.
6
+ */
7
+ export declare function validateContext(ctx: PointeryContext): string[];
8
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,EAAE,CAkC9D"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Check a `pointery.context.json` for the mistakes agents commonly make:
3
+ * missing fields, duplicate keys, guide steps pointing at ids that don't exist.
4
+ * Returns human-readable errors (empty = valid). Used by `npx pointery init --check`.
5
+ */
6
+ export function validateContext(ctx) {
7
+ var _a, _b, _c;
8
+ const errors = [];
9
+ if (!ctx || typeof ctx !== "object")
10
+ return ["context must be an object"];
11
+ const targets = (_a = ctx.targets) !== null && _a !== void 0 ? _a : [];
12
+ const guides = (_b = ctx.guides) !== null && _b !== void 0 ? _b : [];
13
+ const actions = (_c = ctx.actions) !== null && _c !== void 0 ? _c : [];
14
+ const keys = new Set();
15
+ targets.forEach((t, i) => {
16
+ var _a;
17
+ if (!t.key)
18
+ errors.push(`targets[${i}]: missing key`);
19
+ else if (keys.has(t.key))
20
+ errors.push(`targets[${i}]: duplicate key "${t.key}"`);
21
+ else
22
+ keys.add(t.key);
23
+ if (!t.page)
24
+ errors.push(`targets[${i}] (${t.key || "?"}): missing page`);
25
+ if (!t.hint)
26
+ errors.push(`targets[${i}] (${t.key || "?"}): missing hint`);
27
+ if (!((_a = t.keywords) === null || _a === void 0 ? void 0 : _a.length))
28
+ errors.push(`targets[${i}] (${t.key || "?"}): no keywords`);
29
+ });
30
+ const actionNames = new Set();
31
+ actions.forEach((a, i) => {
32
+ if (!a.name)
33
+ errors.push(`actions[${i}]: missing name`);
34
+ else if (actionNames.has(a.name))
35
+ errors.push(`actions[${i}]: duplicate name "${a.name}"`);
36
+ else
37
+ actionNames.add(a.name);
38
+ });
39
+ guides.forEach((g, i) => {
40
+ var _a, _b;
41
+ if (!g.id)
42
+ errors.push(`guides[${i}]: missing id`);
43
+ if (!((_a = g.steps) === null || _a === void 0 ? void 0 : _a.length))
44
+ errors.push(`guides[${i}] (${g.id || "?"}): no steps`);
45
+ (_b = g.steps) === null || _b === void 0 ? void 0 : _b.forEach((s, j) => {
46
+ if (!s.text)
47
+ errors.push(`guides[${i}].steps[${j}]: missing text`);
48
+ if (s.spot && !keys.has(s.spot))
49
+ errors.push(`guides[${i}].steps[${j}]: spot "${s.spot}" matches no target`);
50
+ });
51
+ });
52
+ return errors;
53
+ }
54
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,GAAoB;;IAClD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC1E,MAAM,OAAO,GAAG,MAAA,GAAG,CAAC,OAAO,mCAAI,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,MAAA,GAAG,CAAC,MAAM,mCAAI,EAAE,CAAC;IAChC,MAAM,OAAO,GAAG,MAAA,GAAG,CAAC,OAAO,mCAAI,EAAE,CAAC;IAElC,MAAM,IAAI,GAAG,IAAI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CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;;QACtB,IAAI,CAAC,CAAC,CAAC,EAAE;YAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,CAAA,MAAA,CAAC,CAAC,KAAK,0CAAE,MAAM,CAAA;YAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,GAAG,aAAa,CAAC,CAAC;QAC7E,MAAA,CAAC,CAAC,KAAK,0CAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACxB,IAAI,CAAC,CAAC,CAAC,IAAI;gBAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;YACnE,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;gBAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,IAAI,qBAAqB,CAAC,CAAC;QAC/G,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "pointery",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Ask anything in-app: palette, guides, and allowlisted actions for any SaaS.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./server": {
15
+ "types": "./dist/server.d.ts",
16
+ "default": "./dist/server.js"
17
+ },
18
+ "./resolver": {
19
+ "types": "./dist/resolver.d.ts",
20
+ "default": "./dist/resolver.js"
21
+ },
22
+ "./validate": {
23
+ "types": "./dist/validate.d.ts",
24
+ "default": "./dist/validate.js"
25
+ },
26
+ "./styles.css": "./src/styles.css",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "src/styles.css",
32
+ "bin",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "bin": {
37
+ "pointery": "./bin/pointery.js"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json",
41
+ "prepublishOnly": "npm run build"
42
+ },
43
+ "keywords": [
44
+ "in-app-search",
45
+ "command-palette",
46
+ "user-guides",
47
+ "onboarding",
48
+ "nextjs",
49
+ "react"
50
+ ],
51
+ "engines": {
52
+ "node": ">=18"
53
+ },
54
+ "peerDependencies": {
55
+ "next": ">=14",
56
+ "react": ">=18",
57
+ "react-dom": ">=18"
58
+ },
59
+ "publishConfig": {
60
+ "access": "public"
61
+ }
62
+ }
package/src/styles.css ADDED
@@ -0,0 +1,44 @@
1
+ /* Pointery kit styles. Consumers get these via `import "pointery/styles.css"`. */
2
+
3
+ :root {
4
+ --pointery-primary: #6d28d9;
5
+ --pointery-radius: 14px;
6
+ }
7
+
8
+ /* pulse target */
9
+ @keyframes pointery-ping {
10
+ 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pointery-primary) 55%, transparent); }
11
+ 70% { box-shadow: 0 0 0 12px transparent; }
12
+ 100% { box-shadow: 0 0 0 0 transparent; }
13
+ }
14
+ .pointery-pulse {
15
+ animation: pointery-ping 1.1s ease-out 2;
16
+ outline: 2px solid var(--pointery-primary) !important;
17
+ outline-offset: 3px;
18
+ border-radius: 8px;
19
+ position: relative;
20
+ z-index: 5;
21
+ }
22
+
23
+ /* palette */
24
+ .pointery-overlay { position: fixed; inset: 0; z-index: 60; display: flex; justify-content: center; background: rgb(0 0 0 / 0.25); backdrop-filter: blur(2px); padding: 0 1rem; }
25
+ .pointery-palette { width: min(560px, 100%); height: fit-content; background: #fff; border-radius: var(--pointery-radius); box-shadow: 0 24px 64px rgb(0 0 0 / 0.25); padding: 0.75rem; margin-top: 0; }
26
+ .pointery-palette input { width: 100%; border: 1px solid #e4e4e7; border-radius: calc(var(--pointery-radius) - 4px); padding: 0.8rem 1rem; font-size: 0.95rem; outline: none; }
27
+ .pointery-palette input:focus { border-color: var(--pointery-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pointery-primary) 18%, transparent); }
28
+ .pointery-suggest { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.7rem 0.2rem 0.3rem; }
29
+ .pointery-suggest button { border: 1px solid #e4e4e7; border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.8rem; background: #fafafa; }
30
+ .pointery-suggest button:hover { border-color: var(--pointery-primary); color: var(--pointery-primary); }
31
+ .pointery-result { border-top: 1px solid #f4f4f5; margin-top: 0.6rem; padding: 0.7rem 0.2rem 0.2rem; font-size: 0.9rem; }
32
+ .pointery-meta { padding: 0.5rem 0.2rem 0; font-size: 0.72rem; color: #a1a1aa; }
33
+
34
+ /* toast / guide / confirm / fab */
35
+ .pointery-toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 70; background: #18181b; color: #fff; border-radius: 999px; padding: 0.7rem 1.2rem; font-size: 0.85rem; box-shadow: 0 12px 32px rgb(0 0 0 / 0.3); max-width: min(520px, 90vw); text-align: center; }
36
+ .pointery-guide, .pointery-confirm { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 70; width: 300px; background: #fff; border-radius: var(--pointery-radius); box-shadow: 0 16px 48px rgb(0 0 0 / 0.22); padding: 1rem; font-size: 0.85rem; }
37
+ .pointery-guide-title { font-weight: 700; } .pointery-guide-title span { color: #a1a1aa; font-weight: 400; }
38
+ .pointery-guide-step { margin: 0.4rem 0 0.7rem; color: #52525b; }
39
+ .pointery-guide-row { display: flex; gap: 0.5rem; }
40
+ .pointery-guide-row button { border: 1px solid #e4e4e7; border-radius: 999px; padding: 0.4rem 0.9rem; font-size: 0.8rem; font-weight: 600; }
41
+ .pointery-guide-row button:disabled { opacity: 0.4; }
42
+ .pointery-guide-row button.primary, .pointery-confirm button.primary { background: var(--pointery-primary); border-color: transparent; color: #fff; }
43
+ .pointery-fab { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 60; width: 2.75rem; height: 2.75rem; border-radius: 999px; background: var(--pointery-primary); color: #fff; font-size: 1.2rem; font-weight: 700; box-shadow: 0 12px 28px rgb(0 0 0 / 0.3); }
44
+ .pointery-fab:hover { filter: brightness(1.1); }