@holostaff/sdk 0.10.11 → 0.11.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/dist/actions.d.ts +38 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +360 -0
- package/dist/actions.js.map +1 -0
- package/dist/autopilot/digest.d.ts +8 -0
- package/dist/autopilot/digest.d.ts.map +1 -0
- package/dist/autopilot/digest.js +72 -0
- package/dist/autopilot/digest.js.map +1 -0
- package/dist/autopilot/index.d.ts +28 -0
- package/dist/autopilot/index.d.ts.map +1 -0
- package/dist/autopilot/index.js +413 -0
- package/dist/autopilot/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/stage/actions.js +5 -1
- package/dist/stage/actions.js.map +1 -1
- package/dist/stage/index.js +1 -1
- package/dist/stage/index.js.map +1 -1
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice Stage on-screen actions — voice-stage-actions-design.md.
|
|
3
|
+
*
|
|
4
|
+
* The `act` tool's executor: one small, visible action per call (click /
|
|
5
|
+
* fill / scroll_to / navigate), grounded by VISIBLE labels — the same
|
|
6
|
+
* vocabulary the perceive loop uses. Safety is layered here, not in the
|
|
7
|
+
* prompt: sensitive fields are hard-refused, consequential clicks require
|
|
8
|
+
* the visitor to press an inline Allow pill, every action highlights its
|
|
9
|
+
* target before landing, and actions are spaced (no burst scripting).
|
|
10
|
+
*/
|
|
11
|
+
export interface ActRequest {
|
|
12
|
+
action: 'click' | 'fill' | 'scroll_to' | 'navigate';
|
|
13
|
+
target?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
path?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ActResult {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
/** What actually happened, past tense — the model must not embellish it. */
|
|
20
|
+
did?: string;
|
|
21
|
+
error?: string;
|
|
22
|
+
/** On ambiguity/no-match: visible labels the resolver DID find. */
|
|
23
|
+
candidates?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface ActionExecutor {
|
|
26
|
+
act(req: ActRequest, copilotName: string): Promise<ActResult>;
|
|
27
|
+
/** Remove any pending confirm pill + styles (Stage teardown). */
|
|
28
|
+
destroy(): void;
|
|
29
|
+
}
|
|
30
|
+
export interface ActionExecutorDeps {
|
|
31
|
+
/** Called RIGHT BEFORE an action that will unload the page (navigate, or
|
|
32
|
+
* clicking a same-origin link) — the fast-resume pre-warm: pre-mint the
|
|
33
|
+
* next Realtime key + preserve the avatar session + stash the resume
|
|
34
|
+
* record. Bounded by the caller; never throws into the action. */
|
|
35
|
+
beforeNavigate?: (destPath: string) => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export declare function createActionExecutor(deps?: ActionExecutorDeps): ActionExecutor;
|
|
38
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,CAAA;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,OAAO,CAAA;IACX,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB;AAkBD,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;IAC7D,iEAAiE;IACjE,OAAO,IAAI,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;uEAGmE;IACnE,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACrD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,kBAAuB,GAAG,cAAc,CA8HlF"}
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice Stage on-screen actions — voice-stage-actions-design.md.
|
|
3
|
+
*
|
|
4
|
+
* The `act` tool's executor: one small, visible action per call (click /
|
|
5
|
+
* fill / scroll_to / navigate), grounded by VISIBLE labels — the same
|
|
6
|
+
* vocabulary the perceive loop uses. Safety is layered here, not in the
|
|
7
|
+
* prompt: sensitive fields are hard-refused, consequential clicks require
|
|
8
|
+
* the visitor to press an inline Allow pill, every action highlights its
|
|
9
|
+
* target before landing, and actions are spaced (no burst scripting).
|
|
10
|
+
*/
|
|
11
|
+
import { setDocumentStyles } from './cspStyles.js';
|
|
12
|
+
/** Min spacing between actions — one deliberate step at a time. */
|
|
13
|
+
const MIN_INTERVAL_MS = 800;
|
|
14
|
+
/** Highlight dwell before the action lands (the visitor sees it coming). */
|
|
15
|
+
const HIGHLIGHT_MS = 600;
|
|
16
|
+
/** Guarded-click pill lifetime; expiry = deny. */
|
|
17
|
+
const CONFIRM_TIMEOUT_MS = 15000;
|
|
18
|
+
/** Fields the copilot must never type into — values it cannot truthfully
|
|
19
|
+
* know. Pointing (scroll_to) is the allowed alternative. */
|
|
20
|
+
const SENSITIVE_AUTOCOMPLETE = /^(cc-|one-time-code)/i;
|
|
21
|
+
const SENSITIVE_TEXT = /\b(password|passcode|card number|cvv|cvc|security code|ssn|social security|secret)\b/i;
|
|
22
|
+
/** Visible labels whose click is consequential enough to need the VISITOR's
|
|
23
|
+
* own click on the Allow pill. Matched against the resolved target's label. */
|
|
24
|
+
const GUARDED_CLICK = /\b(pay|payment|place order|buy|purchase|order now|check ?out|confirm|complete|delete|remove|cancel|unsubscribe|send|sign|submit|transfer|upgrade|downgrade)\b/i;
|
|
25
|
+
export function createActionExecutor(deps = {}) {
|
|
26
|
+
let lastActionAt = 0;
|
|
27
|
+
let pendingPill = null;
|
|
28
|
+
let pendingTimer = null;
|
|
29
|
+
const clearPill = () => {
|
|
30
|
+
if (pendingTimer) {
|
|
31
|
+
clearTimeout(pendingTimer);
|
|
32
|
+
pendingTimer = null;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
pendingPill?.remove();
|
|
36
|
+
}
|
|
37
|
+
catch { /* gone */ }
|
|
38
|
+
pendingPill = null;
|
|
39
|
+
};
|
|
40
|
+
const act = async (req, copilotName) => {
|
|
41
|
+
const now = Date.now();
|
|
42
|
+
if (now - lastActionAt < MIN_INTERVAL_MS) {
|
|
43
|
+
await sleep(MIN_INTERVAL_MS - (now - lastActionAt));
|
|
44
|
+
}
|
|
45
|
+
if (pendingPill) {
|
|
46
|
+
return { ok: false, error: 'a previous action is still waiting for the visitor to Allow or Deny' };
|
|
47
|
+
}
|
|
48
|
+
switch (req.action) {
|
|
49
|
+
case 'navigate': {
|
|
50
|
+
const path = (req.path ?? '').trim();
|
|
51
|
+
if (!path)
|
|
52
|
+
return { ok: false, error: 'navigate needs a path' };
|
|
53
|
+
let dest;
|
|
54
|
+
try {
|
|
55
|
+
dest = new URL(path, window.location.origin);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return { ok: false, error: `not a valid path: ${path}` };
|
|
59
|
+
}
|
|
60
|
+
if (dest.origin !== window.location.origin) {
|
|
61
|
+
return { ok: false, error: 'cross-origin navigation is not allowed' };
|
|
62
|
+
}
|
|
63
|
+
lastActionAt = Date.now();
|
|
64
|
+
try {
|
|
65
|
+
await deps.beforeNavigate?.(dest.pathname + dest.search);
|
|
66
|
+
}
|
|
67
|
+
catch { /* best-effort */ }
|
|
68
|
+
window.location.assign(dest.href);
|
|
69
|
+
return { ok: true, did: `navigated to ${dest.pathname}${dest.search}` };
|
|
70
|
+
}
|
|
71
|
+
case 'scroll_to': {
|
|
72
|
+
const found = resolve(req.target ?? '', 'any');
|
|
73
|
+
if (!found.el)
|
|
74
|
+
return { ok: false, error: found.error, candidates: found.candidates };
|
|
75
|
+
found.el.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
76
|
+
await highlight(found.el, HIGHLIGHT_MS * 2);
|
|
77
|
+
lastActionAt = Date.now();
|
|
78
|
+
return { ok: true, did: `scrolled to and highlighted "${found.label}"` };
|
|
79
|
+
}
|
|
80
|
+
case 'click': {
|
|
81
|
+
const found = resolve(req.target ?? '', 'clickable');
|
|
82
|
+
if (!found.el)
|
|
83
|
+
return { ok: false, error: found.error, candidates: found.candidates };
|
|
84
|
+
found.el.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
85
|
+
if (GUARDED_CLICK.test(found.label)) {
|
|
86
|
+
const allowed = await confirmWithVisitor(found.el, found.label, copilotName);
|
|
87
|
+
if (!allowed) {
|
|
88
|
+
return { ok: false, error: `the visitor did not allow clicking "${found.label}"` };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
await highlight(found.el, HIGHLIGHT_MS);
|
|
92
|
+
// Clicking a same-origin link unloads the page just like navigate —
|
|
93
|
+
// pre-warm the resume path first so the conversation survives.
|
|
94
|
+
const anchor = (found.el.closest ? found.el.closest('a[href]') : null);
|
|
95
|
+
if (anchor && !anchor.target && anchor.origin === window.location.origin) {
|
|
96
|
+
try {
|
|
97
|
+
await deps.beforeNavigate?.(anchor.pathname + anchor.search);
|
|
98
|
+
}
|
|
99
|
+
catch { /* best-effort */ }
|
|
100
|
+
}
|
|
101
|
+
fireClick(found.el);
|
|
102
|
+
lastActionAt = Date.now();
|
|
103
|
+
return { ok: true, did: `clicked "${found.label}"` };
|
|
104
|
+
}
|
|
105
|
+
case 'fill': {
|
|
106
|
+
const value = req.value ?? '';
|
|
107
|
+
if (!value)
|
|
108
|
+
return { ok: false, error: 'fill needs a value' };
|
|
109
|
+
const found = resolve(req.target ?? '', 'fillable');
|
|
110
|
+
if (!found.el)
|
|
111
|
+
return { ok: false, error: found.error, candidates: found.candidates };
|
|
112
|
+
const refusal = sensitiveFieldRefusal(found.el, found.label);
|
|
113
|
+
if (refusal)
|
|
114
|
+
return { ok: false, error: refusal };
|
|
115
|
+
found.el.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
116
|
+
await highlight(found.el, HIGHLIGHT_MS);
|
|
117
|
+
const did = setFieldValue(found.el, value);
|
|
118
|
+
lastActionAt = Date.now();
|
|
119
|
+
if (!did)
|
|
120
|
+
return { ok: false, error: `could not set a value on "${found.label}"` };
|
|
121
|
+
return { ok: true, did: `filled "${found.label}"` };
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
return { ok: false, error: `unknown action ${String(req.action)}` };
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
// ── Guarded-click confirmation pill ─────────────────────────────────────
|
|
128
|
+
const confirmWithVisitor = (el, label, copilotName) => {
|
|
129
|
+
ensurePillStyle();
|
|
130
|
+
return new Promise((resolvePromise) => {
|
|
131
|
+
const pill = document.createElement('div');
|
|
132
|
+
pill.className = 'holostaff-act-pill';
|
|
133
|
+
const text = document.createElement('span');
|
|
134
|
+
text.textContent = `${copilotName} wants to click "${label}"`;
|
|
135
|
+
const allow = document.createElement('button');
|
|
136
|
+
allow.type = 'button';
|
|
137
|
+
allow.textContent = 'Allow';
|
|
138
|
+
allow.className = 'allow';
|
|
139
|
+
const deny = document.createElement('button');
|
|
140
|
+
deny.type = 'button';
|
|
141
|
+
deny.textContent = 'Deny';
|
|
142
|
+
deny.className = 'deny';
|
|
143
|
+
pill.append(text, allow, deny);
|
|
144
|
+
const rect = el.getBoundingClientRect();
|
|
145
|
+
pill.style.top = `${Math.max(8, rect.top - 44)}px`;
|
|
146
|
+
pill.style.left = `${Math.max(8, rect.left)}px`;
|
|
147
|
+
document.body.appendChild(pill);
|
|
148
|
+
pendingPill = pill;
|
|
149
|
+
const finish = (verdict) => {
|
|
150
|
+
clearPill();
|
|
151
|
+
resolvePromise(verdict);
|
|
152
|
+
};
|
|
153
|
+
allow.addEventListener('click', () => finish(true));
|
|
154
|
+
deny.addEventListener('click', () => finish(false));
|
|
155
|
+
pendingTimer = setTimeout(() => finish(false), CONFIRM_TIMEOUT_MS);
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
return {
|
|
159
|
+
act,
|
|
160
|
+
destroy() { clearPill(); },
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
// Includes the ARIA roles menu/listbox/tab widgets (Radix, Headless UI)
|
|
164
|
+
// give their items — those render as divs, not buttons, and were
|
|
165
|
+
// invisible to label resolution without their roles listed here.
|
|
166
|
+
const CLICKABLE_SEL = 'a[href], button, [role="button"], input[type="submit"], input[type="button"], summary, '
|
|
167
|
+
+ '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"], [role="tab"], [role="switch"]';
|
|
168
|
+
const FILLABLE_SEL = 'input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="checkbox"]):not([type="radio"]), textarea, select, [contenteditable="true"]';
|
|
169
|
+
function resolve(target, kind) {
|
|
170
|
+
const want = norm(target);
|
|
171
|
+
if (!want)
|
|
172
|
+
return { el: null, label: '', error: 'target (visible label) required' };
|
|
173
|
+
const sel = kind === 'clickable' ? CLICKABLE_SEL
|
|
174
|
+
: kind === 'fillable' ? FILLABLE_SEL
|
|
175
|
+
: `${CLICKABLE_SEL}, ${FILLABLE_SEL}, h1, h2, h3, [aria-label]`;
|
|
176
|
+
const scored = [];
|
|
177
|
+
for (const el of Array.from(document.querySelectorAll(sel))) {
|
|
178
|
+
if (!isVisible(el))
|
|
179
|
+
continue;
|
|
180
|
+
const label = labelFor(el);
|
|
181
|
+
if (!label)
|
|
182
|
+
continue;
|
|
183
|
+
const score = matchScore(want, norm(label));
|
|
184
|
+
if (score > 0)
|
|
185
|
+
scored.push({ el, label, score });
|
|
186
|
+
}
|
|
187
|
+
if (!scored.length) {
|
|
188
|
+
const visible = Array.from(document.querySelectorAll(sel))
|
|
189
|
+
.filter(isVisible).map(labelFor).filter(Boolean).slice(0, 8);
|
|
190
|
+
return { el: null, label: '', error: `nothing on screen matches "${target}"`, candidates: visible };
|
|
191
|
+
}
|
|
192
|
+
scored.sort((a, b) => b.score - a.score);
|
|
193
|
+
const best = scored[0];
|
|
194
|
+
const rival = scored.find(s => s.el !== best.el && s.score === best.score && norm(s.label) !== norm(best.label));
|
|
195
|
+
if (rival) {
|
|
196
|
+
return {
|
|
197
|
+
el: null, label: '',
|
|
198
|
+
error: `"${target}" is ambiguous`,
|
|
199
|
+
candidates: [...new Set(scored.slice(0, 6).map(s => s.label))],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
return { el: best.el, label: best.label };
|
|
203
|
+
}
|
|
204
|
+
function labelFor(el) {
|
|
205
|
+
const aria = el.getAttribute('aria-label');
|
|
206
|
+
if (aria?.trim())
|
|
207
|
+
return aria.trim();
|
|
208
|
+
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLSelectElement) {
|
|
209
|
+
// Associated <label for=…> or wrapping <label>.
|
|
210
|
+
if (el.id) {
|
|
211
|
+
const lab = document.querySelector(`label[for="${cssEscape(el.id)}"]`);
|
|
212
|
+
if (lab?.textContent?.trim())
|
|
213
|
+
return lab.textContent.trim();
|
|
214
|
+
}
|
|
215
|
+
const wrap = el.closest('label');
|
|
216
|
+
if (wrap?.textContent?.trim())
|
|
217
|
+
return wrap.textContent.trim();
|
|
218
|
+
const ph = el.getAttribute('placeholder');
|
|
219
|
+
if (ph?.trim())
|
|
220
|
+
return ph.trim();
|
|
221
|
+
if (el instanceof HTMLInputElement && (el.type === 'submit' || el.type === 'button') && el.value.trim()) {
|
|
222
|
+
return el.value.trim();
|
|
223
|
+
}
|
|
224
|
+
return el.name || '';
|
|
225
|
+
}
|
|
226
|
+
const text = (el.textContent ?? '').trim().replace(/\s+/g, ' ');
|
|
227
|
+
return text.length > 80 ? '' : text;
|
|
228
|
+
}
|
|
229
|
+
function matchScore(want, have) {
|
|
230
|
+
if (!have)
|
|
231
|
+
return 0;
|
|
232
|
+
if (have === want)
|
|
233
|
+
return 3;
|
|
234
|
+
if (have.includes(want) || want.includes(have))
|
|
235
|
+
return 2;
|
|
236
|
+
const wantTokens = want.split(' ').filter(Boolean);
|
|
237
|
+
if (!wantTokens.length)
|
|
238
|
+
return 0;
|
|
239
|
+
const overlap = wantTokens.filter(t => have.includes(t)).length / wantTokens.length;
|
|
240
|
+
return overlap >= 0.6 ? 1 : 0;
|
|
241
|
+
}
|
|
242
|
+
function norm(s) {
|
|
243
|
+
return s.toLowerCase().replace(/\s+/g, ' ').trim();
|
|
244
|
+
}
|
|
245
|
+
function isVisible(el) {
|
|
246
|
+
if (el.disabled)
|
|
247
|
+
return false;
|
|
248
|
+
const rect = el.getBoundingClientRect();
|
|
249
|
+
if (rect.width < 2 || rect.height < 2)
|
|
250
|
+
return false;
|
|
251
|
+
const style = window.getComputedStyle(el);
|
|
252
|
+
return style.visibility !== 'hidden' && style.display !== 'none';
|
|
253
|
+
}
|
|
254
|
+
function cssEscape(s) {
|
|
255
|
+
return typeof CSS !== 'undefined' && CSS.escape ? CSS.escape(s) : s.replace(/["\\]/g, '\\$&');
|
|
256
|
+
}
|
|
257
|
+
// -------------------------------------------------------------------------
|
|
258
|
+
// Guards + mechanics
|
|
259
|
+
// -------------------------------------------------------------------------
|
|
260
|
+
function sensitiveFieldRefusal(el, label) {
|
|
261
|
+
const input = el;
|
|
262
|
+
const type = (input.type ?? '').toLowerCase();
|
|
263
|
+
const auto = (input.autocomplete ?? '');
|
|
264
|
+
const meta = `${label} ${input.name ?? ''} ${input.id ?? ''}`;
|
|
265
|
+
if (type === 'password' || SENSITIVE_AUTOCOMPLETE.test(auto) || SENSITIVE_TEXT.test(meta)) {
|
|
266
|
+
return `"${label}" looks like a sensitive field (password/payment/code). I can point the visitor to it, but they must type it themselves.`;
|
|
267
|
+
}
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
/** Set a field's value the framework-compatible way: native setter + events
|
|
271
|
+
* (React tracks the native value setter; Vue listens to input events). */
|
|
272
|
+
/** A bare el.click() only fires the click event. Menu and popover
|
|
273
|
+
* libraries (Radix, Headless UI) act on pointerdown/pointerup, so a
|
|
274
|
+
* synthetic click passes straight through them. Fire the whole
|
|
275
|
+
* sequence a real pointer produces. */
|
|
276
|
+
function fireClick(el) {
|
|
277
|
+
const base = { bubbles: true, cancelable: true, composed: true, view: window };
|
|
278
|
+
const pointer = { ...base, pointerId: 1, pointerType: 'mouse', isPrimary: true };
|
|
279
|
+
el.dispatchEvent(new PointerEvent('pointerover', pointer));
|
|
280
|
+
el.dispatchEvent(new PointerEvent('pointerdown', pointer));
|
|
281
|
+
el.dispatchEvent(new MouseEvent('mousedown', { ...base, button: 0 }));
|
|
282
|
+
el.dispatchEvent(new PointerEvent('pointerup', pointer));
|
|
283
|
+
el.dispatchEvent(new MouseEvent('mouseup', { ...base, button: 0 }));
|
|
284
|
+
el.click();
|
|
285
|
+
}
|
|
286
|
+
function setFieldValue(el, value) {
|
|
287
|
+
if (el instanceof HTMLSelectElement) {
|
|
288
|
+
const opt = Array.from(el.options).find(o => norm(o.textContent ?? '') === norm(value) || o.value === value);
|
|
289
|
+
if (!opt)
|
|
290
|
+
return false;
|
|
291
|
+
el.value = opt.value;
|
|
292
|
+
el.dispatchEvent(new Event('input', { bubbles: true }));
|
|
293
|
+
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
|
|
297
|
+
const proto = el instanceof HTMLInputElement ? HTMLInputElement.prototype : HTMLTextAreaElement.prototype;
|
|
298
|
+
const setter = Object.getOwnPropertyDescriptor(proto, 'value')?.set;
|
|
299
|
+
el.focus();
|
|
300
|
+
if (setter)
|
|
301
|
+
setter.call(el, value);
|
|
302
|
+
else
|
|
303
|
+
el.value = value;
|
|
304
|
+
el.dispatchEvent(new Event('input', { bubbles: true }));
|
|
305
|
+
el.dispatchEvent(new Event('change', { bubbles: true }));
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
if (el.isContentEditable) {
|
|
309
|
+
el.focus();
|
|
310
|
+
// Rich-text frameworks (Lexical, ProseMirror, Slate) own their DOM and
|
|
311
|
+
// silently revert direct textContent writes. execCommand routes through
|
|
312
|
+
// the browser's editing pipeline (beforeinput), which they all honour.
|
|
313
|
+
let inserted = false;
|
|
314
|
+
try {
|
|
315
|
+
const sel = window.getSelection();
|
|
316
|
+
if (sel) {
|
|
317
|
+
sel.removeAllRanges();
|
|
318
|
+
const range = document.createRange();
|
|
319
|
+
range.selectNodeContents(el);
|
|
320
|
+
sel.addRange(range);
|
|
321
|
+
}
|
|
322
|
+
inserted = document.execCommand('insertText', false, value);
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
inserted = false;
|
|
326
|
+
}
|
|
327
|
+
if (!inserted) {
|
|
328
|
+
el.textContent = value;
|
|
329
|
+
el.dispatchEvent(new Event('input', { bubbles: true }));
|
|
330
|
+
}
|
|
331
|
+
// Believe the DOM, not the attempt: a framework editor may have
|
|
332
|
+
// reverted the write, and claiming success then would be a lie the
|
|
333
|
+
// copilot repeats out loud.
|
|
334
|
+
return norm(el.textContent ?? '').includes(norm(value).slice(0, 24));
|
|
335
|
+
}
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
338
|
+
/** Pulse-outline the target so the visitor sees what's about to be touched. */
|
|
339
|
+
async function highlight(el, ms) {
|
|
340
|
+
const prevOutline = el.style.outline;
|
|
341
|
+
const prevOffset = el.style.outlineOffset;
|
|
342
|
+
el.style.outline = '3px solid #4f8bff';
|
|
343
|
+
el.style.outlineOffset = '2px';
|
|
344
|
+
await sleep(ms);
|
|
345
|
+
el.style.outline = prevOutline;
|
|
346
|
+
el.style.outlineOffset = prevOffset;
|
|
347
|
+
}
|
|
348
|
+
function sleep(ms) {
|
|
349
|
+
return new Promise(r => setTimeout(r, ms));
|
|
350
|
+
}
|
|
351
|
+
const PILL_STYLE_ID = 'holostaff-act-pill-style';
|
|
352
|
+
function ensurePillStyle() {
|
|
353
|
+
setDocumentStyles(PILL_STYLE_ID, `
|
|
354
|
+
.holostaff-act-pill { position: fixed; z-index: 2147483647; display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #0e0f12; color: #fafafa; border-radius: 999px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); font: 12px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
|
|
355
|
+
.holostaff-act-pill button { appearance: none; border: 0; border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 12px; cursor: pointer; }
|
|
356
|
+
.holostaff-act-pill .allow { background: #4f8bff; color: #fff; }
|
|
357
|
+
.holostaff-act-pill .deny { background: rgba(255,255,255,0.12); color: #cfd2d8; }
|
|
358
|
+
`);
|
|
359
|
+
}
|
|
360
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAkBlD,mEAAmE;AACnE,MAAM,eAAe,GAAG,GAAG,CAAA;AAC3B,4EAA4E;AAC5E,MAAM,YAAY,GAAG,GAAG,CAAA;AACxB,kDAAkD;AAClD,MAAM,kBAAkB,GAAG,KAAM,CAAA;AAEjC;6DAC6D;AAC7D,MAAM,sBAAsB,GAAG,uBAAuB,CAAA;AACtD,MAAM,cAAc,GAAG,uFAAuF,CAAA;AAE9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B,iBAAiB,CAAC,aAAa,EAAE;;;;;GAKhC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The autopilot's eyes — a TS port of the engine's page digest
|
|
3
|
+
* (server/scripts/sim/digest.ts, the perception grammar earned over the
|
|
4
|
+
* P0 iterations: dialog awareness, icon labels, dropdown options).
|
|
5
|
+
* Keep the two in lockstep; treat changes as perception-grammar changes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildDigest(): string;
|
|
8
|
+
//# sourceMappingURL=digest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.d.ts","sourceRoot":"","sources":["../../src/autopilot/digest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,WAAW,IAAI,MAAM,CA2DpC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The autopilot's eyes — a TS port of the engine's page digest
|
|
3
|
+
* (server/scripts/sim/digest.ts, the perception grammar earned over the
|
|
4
|
+
* P0 iterations: dialog awareness, icon labels, dropdown options).
|
|
5
|
+
* Keep the two in lockstep; treat changes as perception-grammar changes.
|
|
6
|
+
*/
|
|
7
|
+
export function buildDigest() {
|
|
8
|
+
const out = [];
|
|
9
|
+
const seen = new Set();
|
|
10
|
+
const push = (tag, text) => {
|
|
11
|
+
const t = (text || '').replace(/\s+/g, ' ').trim().slice(0, 140);
|
|
12
|
+
if (!t || seen.has(tag + t))
|
|
13
|
+
return;
|
|
14
|
+
seen.add(tag + t);
|
|
15
|
+
out.push(tag + ': ' + t);
|
|
16
|
+
};
|
|
17
|
+
const vis = (el) => {
|
|
18
|
+
const r = el.getBoundingClientRect();
|
|
19
|
+
return r.width > 2 && r.height > 2 && r.bottom > 0 && r.top < innerHeight * 2.2;
|
|
20
|
+
};
|
|
21
|
+
let root = document;
|
|
22
|
+
const dialogs = [...document.querySelectorAll('[role="dialog"], dialog, [class*="modal"] [class*="content"], [id*="modal"]')]
|
|
23
|
+
.filter(el => {
|
|
24
|
+
if (!vis(el))
|
|
25
|
+
return false;
|
|
26
|
+
const r = el.getBoundingClientRect();
|
|
27
|
+
return r.width * r.height > innerWidth * innerHeight * 0.08 && r.width < innerWidth * 0.95;
|
|
28
|
+
})
|
|
29
|
+
// The autopilot's own surfaces are not part of the page.
|
|
30
|
+
.filter(el => !el.closest('[data-holostaff-autopilot]'));
|
|
31
|
+
if (dialogs.length) {
|
|
32
|
+
root = dialogs[dialogs.length - 1];
|
|
33
|
+
out.push('note: A DIALOG IS OPEN on top of the page — the page behind it is dimmed and NOT clickable. Only what is listed below (the dialog) is interactive right now.');
|
|
34
|
+
}
|
|
35
|
+
const ours = (el) => !!el.closest('[data-holostaff-autopilot], .holostaff-act-pill');
|
|
36
|
+
root.querySelectorAll('h1,h2,h3,[class*="title"]').forEach(el => { if (vis(el) && !ours(el))
|
|
37
|
+
push('heading', el.textContent); });
|
|
38
|
+
root.querySelectorAll('button,[role="button"],a[href]').forEach(el => {
|
|
39
|
+
if (!vis(el) || ours(el))
|
|
40
|
+
return;
|
|
41
|
+
let label = (el.textContent || '').trim() || el.getAttribute('aria-label') || el.getAttribute('title') || '';
|
|
42
|
+
if (!label) {
|
|
43
|
+
const ic = el.querySelector('[class*="i-"]');
|
|
44
|
+
const m = ic && /i-[a-z0-9-]+:([a-z0-9-]+)/.exec(ic.className || '');
|
|
45
|
+
if (m)
|
|
46
|
+
label = '(icon: ' + m[1].replace(/-\d+-(solid|outline)$/, '') + ')';
|
|
47
|
+
}
|
|
48
|
+
push(el.tagName === 'A' ? 'link' : 'button', label);
|
|
49
|
+
});
|
|
50
|
+
root.querySelectorAll('input,textarea,select').forEach(el => {
|
|
51
|
+
if (!vis(el) || ours(el))
|
|
52
|
+
return;
|
|
53
|
+
const input = el;
|
|
54
|
+
const lbl = input.labels && input.labels[0] ? (input.labels[0].textContent || '').trim() : '';
|
|
55
|
+
if (el.tagName === 'SELECT') {
|
|
56
|
+
const sel = el;
|
|
57
|
+
const opts = Array.from(sel.options || []).map(o => (o.textContent || '').trim()).filter(Boolean).slice(0, 12);
|
|
58
|
+
const cur = sel.selectedOptions && sel.selectedOptions[0] ? (sel.selectedOptions[0].textContent || '').trim() : '';
|
|
59
|
+
push('dropdown', 'label="' + lbl + '" current="' + cur + '" options=[' + opts.join(' | ') + ']');
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
push('input', (input.type || el.tagName.toLowerCase()) + ' placeholder="' + (input.placeholder || '') + '" label="' + lbl + '"');
|
|
63
|
+
});
|
|
64
|
+
root.querySelectorAll('code,pre,[class*="alert"],[class*="empty"],[class*="toast"]').forEach(el => { if (vis(el) && !ours(el))
|
|
65
|
+
push('text', el.textContent); });
|
|
66
|
+
root.querySelectorAll('p,li,span[class*="caption"],[class*="subtitle"]').forEach(el => {
|
|
67
|
+
if (vis(el) && !ours(el) && (el.textContent || '').trim().length > 25)
|
|
68
|
+
push('copy', el.textContent);
|
|
69
|
+
});
|
|
70
|
+
return `URL: ${window.location.href}\nTITLE: ${document.title}\n` + out.slice(0, 90).join('\n');
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=digest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digest.js","sourceRoot":"","sources":["../../src/autopilot/digest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,UAAU,WAAW;IACzB,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,IAA+B,EAAQ,EAAE;QAClE,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;QAChE,IAAI,CAAC,CAAC,I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AI,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,GAAG,gBAAgB,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,EAAE,CAAC,GAAG,WAAW,GAAG,GAAG,GAAG,GAAG,CAAC,CAAA;IAClI,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,gBAAgB,CAAC,6DAA6D,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;IAC9J,IAAI,CAAC,gBAAgB,CAAC,iDAAiD,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QACpF,IAAI,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,EAAE;YAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,CAAA;IACrG,CAAC,CAAC,CAAA;IACF,OAAO,QAAQ,MAAM,CAAC,QAAQ,CAAC,IAAI,YAAY,QAAQ,CAAC,KAAK,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACjG,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow autopilot — the deploy-side runtime (autopilots PRD P6, D24-D27).
|
|
3
|
+
*
|
|
4
|
+
* No voice, no face, no chat. The product team certifies an autopilot per
|
|
5
|
+
* workflow; when the visitor enters that workflow's routes, a small offer
|
|
6
|
+
* card appears. On explicit handover the server brain decides one action
|
|
7
|
+
* per tick and the shared action executor performs it in THIS tab, under
|
|
8
|
+
* the visitor's own session — highlight before every act, Allow pill on
|
|
9
|
+
* consequential clicks, sensitive fields always typed by the visitor.
|
|
10
|
+
*
|
|
11
|
+
* Structural safety in this file:
|
|
12
|
+
* - handover only ever starts from the visitor's click
|
|
13
|
+
* - any real pointer/key activity outside our surfaces pauses the loop
|
|
14
|
+
* - Stop is always on screen while the autopilot runs
|
|
15
|
+
* - a full page load resumes an active handover from sessionStorage,
|
|
16
|
+
* so SPA-breaking navigations don't strand the session
|
|
17
|
+
*/
|
|
18
|
+
export interface AutopilotDeps {
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
tenantId: string;
|
|
21
|
+
sourceId: string;
|
|
22
|
+
onError?: (err: Error) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface AutopilotBinding {
|
|
25
|
+
dispose(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function startAutopilot(deps: AutopilotDeps): AutopilotBinding;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/autopilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,IAAI,IAAI,CAAA;CAChB;AA+BD,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,gBAAgB,CAmWpE"}
|