sgiant-ai-widget 1.2.0 → 1.4.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/icons.d.ts +4 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +4 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +68 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +210 -7
- package/dist/index.js.map +1 -1
- package/dist/labels.d.ts +12 -0
- package/dist/labels.d.ts.map +1 -1
- package/dist/labels.js +12 -0
- package/dist/labels.js.map +1 -1
- package/dist/mark-chrome.d.ts +24 -0
- package/dist/mark-chrome.d.ts.map +1 -0
- package/dist/mark-chrome.js +50 -0
- package/dist/mark-chrome.js.map +1 -0
- package/dist/mark-motion.d.ts +43 -0
- package/dist/mark-motion.d.ts.map +1 -0
- package/dist/mark-motion.js +169 -0
- package/dist/mark-motion.js.map +1 -0
- package/dist/sgiant-ai-widget-charts.global.js +1 -1
- package/dist/sgiant-ai-widget.global.js +117 -32
- package/dist/sgiant-ai-widget.global.js.map +4 -4
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +70 -11
- package/dist/styles.js.map +1 -1
- package/package.json +1 -1
package/dist/icons.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export declare const AVATAR_SVG = "<svg viewBox=\"0 0 24 24\" class=\"sgiant-aiw
|
|
|
3
3
|
export declare const ICON_HISTORY = "<svg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M3 3v5h5\"/><path d=\"M3.05 13A9 9 0 1 0 6 5.3L3 8\"/><path d=\"M12 7v5l3 2\"/></svg>";
|
|
4
4
|
export declare const ICON_EXPAND = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M15 3h6v6\"/><path d=\"M9 21H3v-6\"/><path d=\"M21 3l-7 7\"/><path d=\"M3 21l7-7\"/></svg>";
|
|
5
5
|
export declare const ICON_COLLAPSE = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 14h6v6\"/><path d=\"M20 10h-6V4\"/><path d=\"M14 10l7-7\"/><path d=\"M3 21l7-7\"/></svg>";
|
|
6
|
+
/** Auto-apply: a bolt — "this happens without you pressing anything". */
|
|
7
|
+
export declare const ICON_BOLT = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M13 2 4 14h7l-1 8 9-12h-7l1-8Z\"/></svg>";
|
|
8
|
+
/** The automation explainer: a question mark in a circle. */
|
|
9
|
+
export declare const ICON_HELP_CIRCLE = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M9.5 9a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.7\"/><path d=\"M12 17h.01\"/></svg>";
|
|
6
10
|
export declare const ICON_COMPASS = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><polygon points=\"16.2 7.8 13.4 13.4 7.8 16.2 10.6 10.6 16.2 7.8\"/></svg>";
|
|
7
11
|
export declare const ICON_ADVANCED = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><line x1=\"10\" y1=\"4\" x2=\"10\" y2=\"20\"/></svg>";
|
|
8
12
|
export declare const ICON_CHEVRON_R = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"9 18 15 12 9 6\"/></svg>";
|
package/dist/icons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,WAAW,oVAGO,CAAC;AAQhC,eAAO,MAAM,UAAU,yLAA6K,CAAC;AAGrM,eAAO,MAAM,YAAY,2RAAmQ,CAAC;AAC7R,eAAO,MAAM,WAAW,gSAAsQ,CAAC;AAC/R,eAAO,MAAM,aAAa,iSAAuQ,CAAC;AAElS,eAAO,MAAM,YAAY,2SAAiR,CAAC;AAE3S,eAAO,MAAM,aAAa,2SAAuQ,CAAC;AAClS,eAAO,MAAM,cAAc,uOAAmN,CAAC;AAE/O,eAAO,MAAM,aAAa,8UAAgT,CAAC;AAE3U,eAAO,MAAM,SAAS,sTAA0R,CAAC;AAEjT,eAAO,MAAM,SAAS,qSAA+Q,CAAC;AACtS,eAAO,MAAM,aAAa,4ZAA0X,CAAC;AAGrZ,eAAO,MAAM,SAAS,gOAAoM,CAAC;AAG3N,eAAO,MAAM,WAAW,6UAAyT,CAAC;AAGlV,eAAO,MAAM,SAAS,kRAA4P,CAAC;AACnR,eAAO,MAAM,UAAU,sQAAgP,CAAC;AACxQ,eAAO,MAAM,WAAW,0OAAsN,CAAC;AAC/O,eAAO,MAAM,WAAW,yOAAqN,CAAC;AAE9O,eAAO,MAAM,aAAa,8XAAwW,CAAC;AACnY,eAAO,MAAM,eAAe,6XAAuW,CAAC"}
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,WAAW,oVAGO,CAAC;AAQhC,eAAO,MAAM,UAAU,yLAA6K,CAAC;AAGrM,eAAO,MAAM,YAAY,2RAAmQ,CAAC;AAC7R,eAAO,MAAM,WAAW,gSAAsQ,CAAC;AAC/R,eAAO,MAAM,aAAa,iSAAuQ,CAAC;AAElS,yEAAyE;AACzE,eAAO,MAAM,SAAS,2NAAyM,CAAC;AAChO,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,uSAA6Q,CAAC;AAC3S,eAAO,MAAM,YAAY,2SAAiR,CAAC;AAE3S,eAAO,MAAM,aAAa,2SAAuQ,CAAC;AAClS,eAAO,MAAM,cAAc,uOAAmN,CAAC;AAE/O,eAAO,MAAM,aAAa,8UAAgT,CAAC;AAE3U,eAAO,MAAM,SAAS,sTAA0R,CAAC;AAEjT,eAAO,MAAM,SAAS,qSAA+Q,CAAC;AACtS,eAAO,MAAM,aAAa,4ZAA0X,CAAC;AAGrZ,eAAO,MAAM,SAAS,gOAAoM,CAAC;AAG3N,eAAO,MAAM,WAAW,6UAAyT,CAAC;AAGlV,eAAO,MAAM,SAAS,kRAA4P,CAAC;AACnR,eAAO,MAAM,UAAU,sQAAgP,CAAC;AACxQ,eAAO,MAAM,WAAW,0OAAsN,CAAC;AAC/O,eAAO,MAAM,WAAW,yOAAqN,CAAC;AAE9O,eAAO,MAAM,aAAa,8XAAwW,CAAC;AACnY,eAAO,MAAM,eAAe,6XAAuW,CAAC"}
|
package/dist/icons.js
CHANGED
|
@@ -55,6 +55,10 @@ export const ICON_HISTORY = `<svg viewBox="0 0 24 24" width="17" height="17" fil
|
|
|
55
55
|
export const ICON_EXPAND = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 3h6v6"/><path d="M9 21H3v-6"/><path d="M21 3l-7 7"/><path d="M3 21l7-7"/></svg>`;
|
|
56
56
|
export const ICON_COLLAPSE = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 14h6v6"/><path d="M20 10h-6V4"/><path d="M14 10l7-7"/><path d="M3 21l7-7"/></svg>`;
|
|
57
57
|
// Compass — the auto-navigate ("drive me there") toggle.
|
|
58
|
+
/** Auto-apply: a bolt — "this happens without you pressing anything". */
|
|
59
|
+
export const ICON_BOLT = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2 4 14h7l-1 8 9-12h-7l1-8Z"/></svg>`;
|
|
60
|
+
/** The automation explainer: a question mark in a circle. */
|
|
61
|
+
export const ICON_HELP_CIRCLE = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M9.5 9a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.7"/><path d="M12 17h.01"/></svg>`;
|
|
58
62
|
export const ICON_COMPASS = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><polygon points="16.2 7.8 13.4 13.4 7.8 16.2 10.6 10.6 16.2 7.8"/></svg>`;
|
|
59
63
|
// Advanced view: a panel split into a sidebar + main area (Copilot ⇆ live app).
|
|
60
64
|
export const ICON_ADVANCED = `<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="16" rx="2"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MAAM,CAAC,MAAM,UAAU,GAAG,6OAA6O,CAAC;AACxQ,MAAM,CAAC,MAAM,WAAW,GAAG,mNAAmN,CAAC;AAC/O,MAAM,CAAC,MAAM,WAAW,GAAG,kNAAkN,CAAC;AAC9O,qFAAqF;AACrF,MAAM,CAAC,MAAM,aAAa,GAAG,qWAAqW,CAAC;AACnY,MAAM,CAAC,MAAM,eAAe,GAAG,oWAAoW,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -368,6 +368,65 @@ export interface AiChatWidgetOptions {
|
|
|
368
368
|
* navigation is enabled (org/admin/marketing).
|
|
369
369
|
*/
|
|
370
370
|
autoNavOption?: boolean;
|
|
371
|
+
/**
|
|
372
|
+
* How long the launcher sits untouched before it starts to doze — a pair of
|
|
373
|
+
* drifting zeds, and nothing else.
|
|
374
|
+
*
|
|
375
|
+
* NOT the resting state. Resting must stay still: the launcher redraw exists
|
|
376
|
+
* because the old one "stacked eight simultaneous effects at rest, so an
|
|
377
|
+
* unread reply and an idle corner animated about equally — it was loud at rest
|
|
378
|
+
* and had nothing left to say". Dozing is a DIFFERENT state that a person has
|
|
379
|
+
* to earn by leaving, so a still corner remains the normal case and an unread
|
|
380
|
+
* badge still means something.
|
|
381
|
+
*
|
|
382
|
+
* Any pointer, key, focus or scroll wakes it, as does opening the panel or any
|
|
383
|
+
* state that is not resting. 0 disables it entirely. Default 60s.
|
|
384
|
+
*/
|
|
385
|
+
dozeAfterMs?: number;
|
|
386
|
+
/**
|
|
387
|
+
* The mark leans toward the pointer, and its eyes follow — in the launcher,
|
|
388
|
+
* in the chat header, everywhere it is drawn.
|
|
389
|
+
*
|
|
390
|
+
* It reads optional hooks out of whatever `avatarSvg` you supply and skips
|
|
391
|
+
* what is missing: `.pl` / `.pr` for eyes, `.ping` / `.glint` for parallax
|
|
392
|
+
* layers. A mark with none of them still gets the tilt.
|
|
393
|
+
*
|
|
394
|
+
* Off under prefers-reduced-motion and on coarse pointers, without asking.
|
|
395
|
+
*/
|
|
396
|
+
markMotion?: boolean;
|
|
397
|
+
/**
|
|
398
|
+
* How the mark follows the pointer. "spring" (default) eases with overshoot,
|
|
399
|
+
* which suits a mark with specular highlights and curved form. "stepped"
|
|
400
|
+
* snaps to a grid and never rotates — for a flat, heavy mark, where easing a
|
|
401
|
+
* highlight that does not exist reads as borrowed vocabulary.
|
|
402
|
+
*/
|
|
403
|
+
markMotionMode?: "spring" | "stepped";
|
|
404
|
+
/**
|
|
405
|
+
* Offer an "auto-apply" toggle, and decide what it is allowed to apply.
|
|
406
|
+
*
|
|
407
|
+
* A PREDICATE, NOT A BOOLEAN, and that is the design. The widget does not know
|
|
408
|
+
* which of a host's write tools are recoverable: saving a WordPress DRAFT and
|
|
409
|
+
* publishing a page arrive here as the same shape. Only the host knows, so the
|
|
410
|
+
* host says — a proposal is auto-applied ONLY when the toggle is on AND this
|
|
411
|
+
* returns true for it. Everything else keeps its Apply button unchanged.
|
|
412
|
+
*
|
|
413
|
+
* WHAT IT WILL NEVER DO, whatever this returns: run an in-app ACTION carrying
|
|
414
|
+
* a `confirm`, or an `operate` action (filling or clicking on the user's
|
|
415
|
+
* behalf). Those are confirm-gated by construction and this option does not
|
|
416
|
+
* reach them. Auto-apply covers PROPOSALS only.
|
|
417
|
+
*
|
|
418
|
+
* Off by default, browser-local, per user. Omit it and no toggle appears and
|
|
419
|
+
* nothing is ever auto-applied — which is what every host had before this.
|
|
420
|
+
*/
|
|
421
|
+
autoApplyOption?: (name: string, args: Record<string, unknown>) => boolean;
|
|
422
|
+
/**
|
|
423
|
+
* Offer a "How automation works" panel in the More menu, explaining what the
|
|
424
|
+
* automation toggles do and — more usefully — what they will never do.
|
|
425
|
+
* Defaults to true whenever either toggle is offered: a switch that changes
|
|
426
|
+
* what an assistant may do on your behalf should explain itself where it is
|
|
427
|
+
* thrown, not in documentation nobody opens.
|
|
428
|
+
*/
|
|
429
|
+
automationHelp?: boolean;
|
|
371
430
|
/**
|
|
372
431
|
* ADVANCED VIEW. When `getAdvancedUrl` is provided, a header toggle opens a
|
|
373
432
|
* full-screen split: the chat on the left and the app in an <iframe> on the
|
|
@@ -583,6 +642,15 @@ export interface AiChatWidgetOptions {
|
|
|
583
642
|
}[]>;
|
|
584
643
|
}
|
|
585
644
|
export { gateNavigationTarget } from "./safe-url";
|
|
645
|
+
/**
|
|
646
|
+
* The assistant's character mark, for sgiant's OWN surfaces.
|
|
647
|
+
*
|
|
648
|
+
* Exported rather than made the default, because the default is the sgiant
|
|
649
|
+
* brand crescent and that is what an embedder on their own site should get.
|
|
650
|
+
* Pass this with `markMotionMode: "stepped"` — it is a flat mark and the
|
|
651
|
+
* spring default is built for a curved, glossy one.
|
|
652
|
+
*/
|
|
653
|
+
export { CHROME_MARK } from "./mark-chrome";
|
|
586
654
|
/**
|
|
587
655
|
* Renders one custom `[[<tag>:{json}]]` directive into `host` (already
|
|
588
656
|
* mounted in the chat log). `spec` is the directive's parsed JSON — validate
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EACL,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AA6BxB,OAAO,EAAE,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,WAAW,CAAC;AAOnB,OAAO,EACL,aAAa,EACb,cAAc,EAC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;AAEzB;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAChE,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB;6DACyD;IACzD,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnE,+EAA+E;IAC7E,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;CACxC;AAuHD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,mBAAmB,GACxB,kBAAkB,CAirKpB"}
|
package/dist/index.js
CHANGED
|
@@ -69,6 +69,7 @@ export { PREFIX };
|
|
|
69
69
|
* can never drift onto different strings and silently produce a dead button.
|
|
70
70
|
*/
|
|
71
71
|
export const OPEN_ASSISTANT_EVENT = "sgiant:open-assistant";
|
|
72
|
+
import { startMarkMotion } from "./mark-motion.js";
|
|
72
73
|
export { buildThreadReplay } from "./replay.js";
|
|
73
74
|
// The directive vocabulary moved to `./specs.ts` (#320): what the model may
|
|
74
75
|
// emit inside `[[tag:{json}]]`, and the parsing of it. #306 calls this the
|
|
@@ -79,10 +80,19 @@ import { LEAD_TOKEN, buildField, isTruthyValue, isPrimitiveArg, proposalFields,
|
|
|
79
80
|
// widget publishes.
|
|
80
81
|
import { isSafeRelPath, gateNavigationTarget, isSafeFrameUrl, } from "./safe-url.js";
|
|
81
82
|
export { gateNavigationTarget } from "./safe-url.js";
|
|
83
|
+
/**
|
|
84
|
+
* The assistant's character mark, for sgiant's OWN surfaces.
|
|
85
|
+
*
|
|
86
|
+
* Exported rather than made the default, because the default is the sgiant
|
|
87
|
+
* brand crescent and that is what an embedder on their own site should get.
|
|
88
|
+
* Pass this with `markMotionMode: "stepped"` — it is a flat mark and the
|
|
89
|
+
* spring default is built for a curved, glossy one.
|
|
90
|
+
*/
|
|
91
|
+
export { CHROME_MARK } from "./mark-chrome.js";
|
|
82
92
|
// Every SVG this file draws now lives in `./icons.ts` (#320) — pure data,
|
|
83
93
|
// and the file an embedder must point at to replace the mark (#306:
|
|
84
94
|
// `avatarUrl` only accepts a bitmap today).
|
|
85
|
-
import { AVATAR_DEFS, AVATAR_SVG, ICON_HISTORY, ICON_EXPAND, ICON_COLLAPSE, ICON_COMPASS, ICON_ADVANCED, ICON_CHEVRON_R, ICON_DOWNLOAD, ICON_FLAG, ICON_BELL, ICON_BELL_OFF, ICON_MORE, ICON_ATTACH, ICON_EDIT, ICON_REGEN, ICON_THUMB_UP, ICON_THUMB_DOWN, } from "./icons.js";
|
|
95
|
+
import { AVATAR_DEFS, AVATAR_SVG, ICON_HISTORY, ICON_EXPAND, ICON_COLLAPSE, ICON_COMPASS, ICON_BOLT, ICON_HELP_CIRCLE, ICON_ADVANCED, ICON_CHEVRON_R, ICON_DOWNLOAD, ICON_FLAG, ICON_BELL, ICON_BELL_OFF, ICON_MORE, ICON_ATTACH, ICON_EDIT, ICON_REGEN, ICON_THUMB_UP, ICON_THUMB_DOWN, } from "./icons.js";
|
|
86
96
|
/**
|
|
87
97
|
* Warn a host about a malformed frame — once per reason, per page.
|
|
88
98
|
*
|
|
@@ -393,7 +403,9 @@ export function createAiChatWidget(opts) {
|
|
|
393
403
|
function applyLauncher() {
|
|
394
404
|
const dot = bubble.querySelector(`.${PREFIX}-bubble-dot`);
|
|
395
405
|
const label = bubble.querySelector(`.${PREFIX}-bubble-label`);
|
|
396
|
-
|
|
406
|
+
// "resting" is the ABSENCE of the others, so it never carried a class —
|
|
407
|
+
// and a state you cannot select is a state you cannot decorate.
|
|
408
|
+
for (const s of ["resting", "unread", "working", "offline", "parked"]) {
|
|
397
409
|
bubble.classList.toggle(`${PREFIX}-bubble-${s}`, launcher.state === s);
|
|
398
410
|
}
|
|
399
411
|
bubble.classList.toggle(`${PREFIX}-bubble-pill`, launcher.variant === "pill");
|
|
@@ -410,11 +422,55 @@ export function createAiChatWidget(opts) {
|
|
|
410
422
|
? L("openBubbleUnread", { name, count: launcher.count })
|
|
411
423
|
: L("openBubble", { name }));
|
|
412
424
|
}
|
|
425
|
+
// Assigned once the panel exists. A no-op until then, because `panel` is
|
|
426
|
+
// declared BELOW this point and reaching it eagerly would be a temporal dead
|
|
427
|
+
// zone — the same trap that took the whole widget down earlier in this file's
|
|
428
|
+
// history when a toggle read `advanced` while the menu was being built.
|
|
429
|
+
let wake = () => { };
|
|
413
430
|
function setLauncher(next) {
|
|
414
431
|
Object.assign(launcher, next);
|
|
415
432
|
applyLauncher();
|
|
433
|
+
wake();
|
|
416
434
|
}
|
|
417
435
|
const panel = el("div", `${PREFIX}-panel`);
|
|
436
|
+
// DOZING — earned by absence, not shown by default. See `dozeAfterMs`.
|
|
437
|
+
const dozeAfter = opts.dozeAfterMs ?? 60000;
|
|
438
|
+
let dozeTimer = null;
|
|
439
|
+
function doze() {
|
|
440
|
+
// Only a RESTING, closed launcher may doze. A working or unread one has
|
|
441
|
+
// something to say, and saying it while asleep is a contradiction.
|
|
442
|
+
if (launcher.state !== "resting" || panel.style.display !== "none")
|
|
443
|
+
return;
|
|
444
|
+
bubble.classList.add(`${PREFIX}-bubble-dozing`);
|
|
445
|
+
}
|
|
446
|
+
wake = () => {
|
|
447
|
+
bubble.classList.remove(`${PREFIX}-bubble-dozing`);
|
|
448
|
+
if (dozeTimer)
|
|
449
|
+
clearTimeout(dozeTimer);
|
|
450
|
+
dozeTimer = dozeAfter > 0 ? setTimeout(doze, dozeAfter) : null;
|
|
451
|
+
};
|
|
452
|
+
// The mark's physics, for EVERY copy of it — launcher and chat header alike.
|
|
453
|
+
// It lived in an example page first, which meant the demo mark followed the
|
|
454
|
+
// cursor while the identical mark in the chat header sat still.
|
|
455
|
+
let motion = null;
|
|
456
|
+
if (opts.markMotion !== false) {
|
|
457
|
+
motion = startMarkMotion(() => {
|
|
458
|
+
const hosts = [bubble];
|
|
459
|
+
panel
|
|
460
|
+
.querySelectorAll(`.${PREFIX}-avatar`)
|
|
461
|
+
.forEach((n) => hosts.push(n));
|
|
462
|
+
return hosts;
|
|
463
|
+
}, { mode: opts.markMotionMode ?? "spring" });
|
|
464
|
+
}
|
|
465
|
+
if (dozeAfter > 0) {
|
|
466
|
+
// On the DOCUMENT and passive: a wake-up that only fired over the launcher
|
|
467
|
+
// itself would let the corner sleep while its owner worked two inches away,
|
|
468
|
+
// and the widget must not be the reason a page scrolls badly.
|
|
469
|
+
for (const ev of ["pointerdown", "pointermove", "keydown", "scroll", "focusin"]) {
|
|
470
|
+
document.addEventListener(ev, wake, { passive: true });
|
|
471
|
+
}
|
|
472
|
+
wake();
|
|
473
|
+
}
|
|
418
474
|
// Theme: the stylesheet is written entirely against --aiw-* custom
|
|
419
475
|
// properties, with light defaults + a prefers-color-scheme:dark token block
|
|
420
476
|
// baked into the sheet. Only what the host EXPLICITLY passed goes inline on
|
|
@@ -882,24 +938,139 @@ export function createAiChatWidget(opts) {
|
|
|
882
938
|
}
|
|
883
939
|
// Auto-navigate toggle — a BROWSER-LOCAL setting: when on, Copilot follows its
|
|
884
940
|
// own navigation suggestions automatically (no confirm button). Off by default.
|
|
941
|
+
// DECLARED HERE, not with the rest of the advanced-view state further down.
|
|
942
|
+
// The auto-navigate toggle reads it while the header menu is being built, and
|
|
943
|
+
// a `let` declared after that point is in its temporal dead zone at that
|
|
944
|
+
// moment — accessing it threw "Cannot access 'advanced' before
|
|
945
|
+
// initialization" and took the WHOLE widget down on mount, not just the
|
|
946
|
+
// toggle. Caught by opening the examples page; no test asserted the widget
|
|
947
|
+
// mounts with these options set, which is the more useful gap.
|
|
948
|
+
let advanced = false;
|
|
885
949
|
const AUTONAV_KEY = `${ns}:autonav`;
|
|
886
950
|
let autoNav = readFlag(AUTONAV_KEY);
|
|
951
|
+
// Auto-apply: proposals the host has classified as safe are applied without
|
|
952
|
+
// the user pressing Apply. Off by default and browser-local, like auto-nav.
|
|
953
|
+
const AUTOAPPLY_KEY = `${ns}:autoapply`;
|
|
954
|
+
let autoApply = readFlag(AUTOAPPLY_KEY);
|
|
955
|
+
let syncAutomation = () => { };
|
|
887
956
|
if (opts.autoNavOption) {
|
|
888
957
|
const autoNavItem = menuItem(L("autoNavigate"));
|
|
889
958
|
autoNavItem.ico.innerHTML = ICON_COMPASS;
|
|
890
959
|
const syncAutoNav = () => {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
960
|
+
// ADVANCED MODE PINS IT ON, and now says so instead of lying about it.
|
|
961
|
+
// Advanced has always auto-run pure navigation unconditionally — the guard
|
|
962
|
+
// downstream reads `(autoNav || advanced)` — so a toggle showing "off"
|
|
963
|
+
// there was describing behaviour that was not happening. Pinned and
|
|
964
|
+
// disabled is the honest rendering of what the code already does.
|
|
965
|
+
const pinned = advanced;
|
|
966
|
+
autoNavItem.setState(pinned || autoNav);
|
|
967
|
+
autoNavItem.btn.disabled = pinned;
|
|
968
|
+
autoNavItem.btn.title = pinned
|
|
969
|
+
? L("autoNavPinnedHint")
|
|
970
|
+
: autoNav
|
|
971
|
+
? L("autoNavOnHint")
|
|
972
|
+
: L("autoNavOffHint");
|
|
895
973
|
};
|
|
896
974
|
syncAutoNav();
|
|
897
975
|
autoNavItem.btn.addEventListener("click", () => {
|
|
976
|
+
if (advanced)
|
|
977
|
+
return;
|
|
898
978
|
autoNav = !autoNav;
|
|
899
979
|
writeFlag(AUTONAV_KEY, autoNav);
|
|
900
980
|
syncAutoNav();
|
|
901
981
|
});
|
|
902
982
|
moreMenu.appendChild(autoNavItem.btn);
|
|
983
|
+
const prevNav = syncAutomation;
|
|
984
|
+
syncAutomation = () => {
|
|
985
|
+
prevNav();
|
|
986
|
+
syncAutoNav();
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
// Auto-apply — PROPOSALS ONLY, and only those the host says are safe. Never
|
|
990
|
+
// pinned by advanced mode: advanced makes the assistant faster at moving
|
|
991
|
+
// around, which is not a reason to let it write without being asked.
|
|
992
|
+
if (opts.autoApplyOption) {
|
|
993
|
+
const autoApplyItem = menuItem(L("autoApply"));
|
|
994
|
+
autoApplyItem.ico.innerHTML = ICON_BOLT;
|
|
995
|
+
const syncAutoApply = () => {
|
|
996
|
+
autoApplyItem.setState(autoApply);
|
|
997
|
+
autoApplyItem.btn.title = autoApply
|
|
998
|
+
? L("autoApplyOnHint")
|
|
999
|
+
: L("autoApplyOffHint");
|
|
1000
|
+
};
|
|
1001
|
+
syncAutoApply();
|
|
1002
|
+
autoApplyItem.btn.addEventListener("click", () => {
|
|
1003
|
+
autoApply = !autoApply;
|
|
1004
|
+
writeFlag(AUTOAPPLY_KEY, autoApply);
|
|
1005
|
+
syncAutoApply();
|
|
1006
|
+
});
|
|
1007
|
+
moreMenu.appendChild(autoApplyItem.btn);
|
|
1008
|
+
const prevApply = syncAutomation;
|
|
1009
|
+
syncAutomation = () => {
|
|
1010
|
+
prevApply();
|
|
1011
|
+
syncAutoApply();
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
// "How automation works" — the explainer.
|
|
1015
|
+
//
|
|
1016
|
+
// WHY IT IS IN THE MENU AND NOT IN DOCS. These two switches change what an
|
|
1017
|
+
// assistant may do on someone's behalf. The person deciding is standing in a
|
|
1018
|
+
// dropdown, not reading a manual, and "Auto-apply — on/off" tells them nothing
|
|
1019
|
+
// about what is still going to ask them first. The panel is deliberately
|
|
1020
|
+
// heavier on what NEVER happens than on what does: that is the part a person
|
|
1021
|
+
// needs to trust the switch, and the part they cannot infer from the label.
|
|
1022
|
+
const offersAutomation = Boolean(opts.autoNavOption || opts.autoApplyOption);
|
|
1023
|
+
if (offersAutomation && opts.automationHelp !== false) {
|
|
1024
|
+
const helpItem = menuItem(L("automationHelp"));
|
|
1025
|
+
helpItem.ico.innerHTML = ICON_HELP_CIRCLE;
|
|
1026
|
+
// No on/off state — it is a door, not a switch.
|
|
1027
|
+
helpItem.btn.querySelector(`.${PREFIX}-menu-state`)?.remove();
|
|
1028
|
+
helpItem.btn.addEventListener("click", () => {
|
|
1029
|
+
// `setMenu(false)`, not a class the menu does not use. The first version
|
|
1030
|
+
// removed `-more-open` from the wrapper; the menu is opened by toggling
|
|
1031
|
+
// `-menu-open` on the MENU, so the dropdown stayed up on top of the panel
|
|
1032
|
+
// it had just opened. Nothing threw — it just looked wrong, which is why
|
|
1033
|
+
// it took opening the page to see.
|
|
1034
|
+
setMenu(false);
|
|
1035
|
+
const sheet = el("div", `${PREFIX}-automation`);
|
|
1036
|
+
const card = el("div", `${PREFIX}-automation-card`);
|
|
1037
|
+
const h = el("h3", `${PREFIX}-automation-title`);
|
|
1038
|
+
h.textContent = L("automationHelpTitle");
|
|
1039
|
+
card.appendChild(h);
|
|
1040
|
+
const lines = [];
|
|
1041
|
+
if (opts.autoNavOption) {
|
|
1042
|
+
lines.push(advanced ? L("automationHelpNavPinned") : L("automationHelpNav"));
|
|
1043
|
+
}
|
|
1044
|
+
if (opts.autoApplyOption)
|
|
1045
|
+
lines.push(L("automationHelpApply"));
|
|
1046
|
+
lines.push(L("automationHelpNever"));
|
|
1047
|
+
lines.push(L("automationHelpLocal"));
|
|
1048
|
+
for (const text of lines) {
|
|
1049
|
+
const para = el("p", `${PREFIX}-automation-line`);
|
|
1050
|
+
para.textContent = text;
|
|
1051
|
+
card.appendChild(para);
|
|
1052
|
+
}
|
|
1053
|
+
const close = el("button", `${PREFIX}-automation-close`);
|
|
1054
|
+
close.type = "button";
|
|
1055
|
+
close.textContent = L("automationHelpClose");
|
|
1056
|
+
const dismiss = () => sheet.remove();
|
|
1057
|
+
close.addEventListener("click", dismiss);
|
|
1058
|
+
// Click-outside and Escape both close it — a panel that traps someone who
|
|
1059
|
+
// opened it out of curiosity teaches them not to open things.
|
|
1060
|
+
sheet.addEventListener("click", (e) => {
|
|
1061
|
+
if (e.target === sheet)
|
|
1062
|
+
dismiss();
|
|
1063
|
+
});
|
|
1064
|
+
sheet.addEventListener("keydown", (e) => {
|
|
1065
|
+
if (e.key === "Escape")
|
|
1066
|
+
dismiss();
|
|
1067
|
+
});
|
|
1068
|
+
card.appendChild(close);
|
|
1069
|
+
sheet.appendChild(card);
|
|
1070
|
+
panel.appendChild(sheet);
|
|
1071
|
+
close.focus();
|
|
1072
|
+
});
|
|
1073
|
+
moreMenu.appendChild(helpItem.btn);
|
|
903
1074
|
}
|
|
904
1075
|
// The "More" menu holds the secondary controls; drop it into the header after
|
|
905
1076
|
// the primary actions (new chat / history), before expand + close.
|
|
@@ -2206,6 +2377,24 @@ export function createAiChatWidget(opts) {
|
|
|
2206
2377
|
// Restore an unsent draft from a prior session; keep it in sync as they type.
|
|
2207
2378
|
input.value = loadDraft();
|
|
2208
2379
|
input.addEventListener("input", () => saveDraft(input.value));
|
|
2380
|
+
// WHILE YOU TYPE, IT WATCHES WHAT YOU TYPE. The mark stops following the
|
|
2381
|
+
// pointer and looks at the composer instead — the small courtesy of appearing
|
|
2382
|
+
// to read over your shoulder, and a clearer signal than any spinner that the
|
|
2383
|
+
// thing is attending to you rather than to the page.
|
|
2384
|
+
//
|
|
2385
|
+
// Released on blur and when the field empties, so the mark goes back to the
|
|
2386
|
+
// cursor rather than staring at an empty box forever.
|
|
2387
|
+
const watchComposer = () => {
|
|
2388
|
+
if (!motion)
|
|
2389
|
+
return;
|
|
2390
|
+
const r = input.getBoundingClientRect();
|
|
2391
|
+
motion.attend(input.value.trim() || document.activeElement === input
|
|
2392
|
+
? { x: r.left + r.width * 0.18, y: r.top + r.height / 2 }
|
|
2393
|
+
: null);
|
|
2394
|
+
};
|
|
2395
|
+
input.addEventListener("input", watchComposer);
|
|
2396
|
+
input.addEventListener("focus", watchComposer);
|
|
2397
|
+
input.addEventListener("blur", () => motion?.attend(null));
|
|
2209
2398
|
const sendBtn = el("button", `${PREFIX}-send`);
|
|
2210
2399
|
sendBtn.type = "submit";
|
|
2211
2400
|
sendBtn.textContent = L("send");
|
|
@@ -2623,7 +2812,6 @@ export function createAiChatWidget(opts) {
|
|
|
2623
2812
|
// that Copilot drives via the agent bridge. Navigation moves the FRAME; on-page
|
|
2624
2813
|
// actions (highlight/fill/click) run INSIDE the frame over postMessage, so they
|
|
2625
2814
|
// hit the app the user is watching — not the parent shell behind the overlay.
|
|
2626
|
-
let advanced = false;
|
|
2627
2815
|
let advancedFull = false;
|
|
2628
2816
|
let paneCollapsed = false;
|
|
2629
2817
|
let transport = null;
|
|
@@ -3845,6 +4033,21 @@ export function createAiChatWidget(opts) {
|
|
|
3845
4033
|
wrap.appendChild(row);
|
|
3846
4034
|
log.appendChild(wrap);
|
|
3847
4035
|
scrollDown(true);
|
|
4036
|
+
// AUTO-APPLY — three conditions, all required, and each one is a decision.
|
|
4037
|
+
//
|
|
4038
|
+
// 1. the user turned it on. Off by default, browser-local, theirs.
|
|
4039
|
+
// 2. the HOST says this particular write is safe to apply unasked. The
|
|
4040
|
+
// widget cannot tell a draft from a publish — they arrive here as the
|
|
4041
|
+
// same shape — so it never guesses; no predicate means nothing applies.
|
|
4042
|
+
// 3. the card asks the user for NOTHING. `fields` are inputs the assistant
|
|
4043
|
+
// explicitly requested; applying past them would answer a question that
|
|
4044
|
+
// was put to the person, using whatever the model guessed.
|
|
4045
|
+
//
|
|
4046
|
+
// The card is still rendered and still says what happened. Auto-apply
|
|
4047
|
+
// removes a click, not the record of the change.
|
|
4048
|
+
if (autoApply && !fields.length && opts.autoApplyOption?.(name, args)) {
|
|
4049
|
+
apply.click();
|
|
4050
|
+
}
|
|
3848
4051
|
}
|
|
3849
4052
|
/**
|
|
3850
4053
|
* Stream-loss recovery. The api runs a turn to completion and persists the
|