@things-factory/ai-assistant 10.1.52 → 10.1.58
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/client/components/assistant-dock.ts +44 -5
- package/client/setup-assistant-dock.ts +54 -19
- package/client/utils/assistant-ask.ts +8 -0
- package/dist-client/components/assistant-dock.d.ts +1 -0
- package/dist-client/components/assistant-dock.js +47 -5
- package/dist-client/components/assistant-dock.js.map +1 -1
- package/dist-client/setup-assistant-dock.js +54 -19
- package/dist-client/setup-assistant-dock.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/assistant-ask.d.ts +5 -0
- package/dist-client/utils/assistant-ask.js +7 -0
- package/dist-client/utils/assistant-ask.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/test/assistant-dock.test.ts +20 -0
- package/translations/en.json +2 -1
- package/translations/ja.json +2 -1
- package/translations/ko.json +2 -1
- package/translations/ms.json +2 -1
- package/translations/zh.json +2 -1
|
@@ -17,6 +17,11 @@ export interface AssistantAsk {
|
|
|
17
17
|
}
|
|
18
18
|
type Listener = () => void;
|
|
19
19
|
export declare function askAssistant(ask: AssistantAsk): void;
|
|
20
|
+
/**
|
|
21
|
+
* The dock could not take it yet and keeps it for when a conversation stands - a draft only. Nothing is announced:
|
|
22
|
+
* it was already asked for, and announcing would make the dock take it again at once.
|
|
23
|
+
*/
|
|
24
|
+
export declare function holdAssistantAsk(ask: AssistantAsk): void;
|
|
20
25
|
/** The dock takes the request once. */
|
|
21
26
|
export declare function takeAssistantAsk(): AssistantAsk | undefined;
|
|
22
27
|
export declare function subscribeAssistantAsk(listener: Listener): () => void;
|
|
@@ -5,6 +5,13 @@ export function askAssistant(ask) {
|
|
|
5
5
|
listeners.forEach(listener => listener());
|
|
6
6
|
window.dispatchEvent(new CustomEvent('assistant-dock-open'));
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* The dock could not take it yet and keeps it for when a conversation stands - a draft only. Nothing is announced:
|
|
10
|
+
* it was already asked for, and announcing would make the dock take it again at once.
|
|
11
|
+
*/
|
|
12
|
+
export function holdAssistantAsk(ask) {
|
|
13
|
+
pending = ask;
|
|
14
|
+
}
|
|
8
15
|
/** The dock takes the request once. */
|
|
9
16
|
export function takeAssistantAsk() {
|
|
10
17
|
const ask = pending;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-ask.js","sourceRoot":"","sources":["../../client/utils/assistant-ask.ts"],"names":[],"mappings":"AAwBA,IAAI,OAAiC,CAAA;AACrC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAY,CAAA;AAErC,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC5C,OAAO,GAAG,GAAG,CAAA;IACb,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;IACzC,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAC9D,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,gBAAgB;IAC9B,MAAM,GAAG,GAAG,OAAO,CAAA;IACnB,OAAO,GAAG,SAAS,CAAA;IACnB,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAkB;IACtD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACvB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACzC,CAAC","sourcesContent":["/*\n * Asking the assistant from another screen - `askAssistant()` (design/ai/shared-dock.md §2-11).\n *\n * Generalised from operato-twin's promotion channel and operato-plant's ask box: a toast's \"ask AI\", a\n * header ask box, a performance page carrying its context. The request waits here until the dock takes it,\n * so a dock that is closed (not mounted) still gets it when it opens.\n */\nexport interface AssistantAsk {\n /** Sent as the next question. */\n ask?: string\n /** Put in the input, not sent. */\n draft?: string\n /** Ask in the open conversation instead of a new one. */\n continueCurrent?: boolean\n /** A new conversation's name. */\n name?: string\n /** Turns carried into the new conversation before the question. */\n transcript?: { role: 'user' | 'ai'; content: string }[]\n /** A note stored first: what the screen was showing when the person asked. */\n context?: string\n}\n\ntype Listener = () => void\n\nlet pending: AssistantAsk | undefined\nconst listeners = new Set<Listener>()\n\nexport function askAssistant(ask: AssistantAsk): void {\n pending = ask\n listeners.forEach(listener => listener())\n window.dispatchEvent(new CustomEvent('assistant-dock-open'))\n}\n\n/** The dock takes the request once. */\nexport function takeAssistantAsk(): AssistantAsk | undefined {\n const ask = pending\n pending = undefined\n return ask\n}\n\nexport function subscribeAssistantAsk(listener: Listener): () => void {\n listeners.add(listener)\n return () => listeners.delete(listener)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"assistant-ask.js","sourceRoot":"","sources":["../../client/utils/assistant-ask.ts"],"names":[],"mappings":"AAwBA,IAAI,OAAiC,CAAA;AACrC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAY,CAAA;AAErC,MAAM,UAAU,YAAY,CAAC,GAAiB;IAC5C,OAAO,GAAG,GAAG,CAAA;IACb,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;IACzC,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,qBAAqB,CAAC,CAAC,CAAA;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAiB;IAChD,OAAO,GAAG,GAAG,CAAA;AACf,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,gBAAgB;IAC9B,MAAM,GAAG,GAAG,OAAO,CAAA;IACnB,OAAO,GAAG,SAAS,CAAA;IACnB,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAkB;IACtD,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACvB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACzC,CAAC","sourcesContent":["/*\n * Asking the assistant from another screen - `askAssistant()` (design/ai/shared-dock.md §2-11).\n *\n * Generalised from operato-twin's promotion channel and operato-plant's ask box: a toast's \"ask AI\", a\n * header ask box, a performance page carrying its context. The request waits here until the dock takes it,\n * so a dock that is closed (not mounted) still gets it when it opens.\n */\nexport interface AssistantAsk {\n /** Sent as the next question. */\n ask?: string\n /** Put in the input, not sent. */\n draft?: string\n /** Ask in the open conversation instead of a new one. */\n continueCurrent?: boolean\n /** A new conversation's name. */\n name?: string\n /** Turns carried into the new conversation before the question. */\n transcript?: { role: 'user' | 'ai'; content: string }[]\n /** A note stored first: what the screen was showing when the person asked. */\n context?: string\n}\n\ntype Listener = () => void\n\nlet pending: AssistantAsk | undefined\nconst listeners = new Set<Listener>()\n\nexport function askAssistant(ask: AssistantAsk): void {\n pending = ask\n listeners.forEach(listener => listener())\n window.dispatchEvent(new CustomEvent('assistant-dock-open'))\n}\n\n/**\n * The dock could not take it yet and keeps it for when a conversation stands - a draft only. Nothing is announced:\n * it was already asked for, and announcing would make the dock take it again at once.\n */\nexport function holdAssistantAsk(ask: AssistantAsk): void {\n pending = ask\n}\n\n/** The dock takes the request once. */\nexport function takeAssistantAsk(): AssistantAsk | undefined {\n const ask = pending\n pending = undefined\n return ask\n}\n\nexport function subscribeAssistantAsk(listener: Listener): () => void {\n listeners.add(listener)\n return () => listeners.delete(listener)\n}\n"]}
|