@g9tm/aiassistant 1.9.4 → 1.9.6
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/assistant.d.ts +2 -0
- package/dist/assistant.js +10 -0
- package/dist/i18n.js +0 -16
- package/dist/pages.js +16 -0
- package/dist/types.d.ts +3 -2
- package/package.json +2 -2
package/dist/assistant.d.ts
CHANGED
|
@@ -106,6 +106,8 @@ export declare class Assistant {
|
|
|
106
106
|
private emit;
|
|
107
107
|
/** Opens a conversation from its history (from the end; history never animates). */
|
|
108
108
|
open(conversationId: string): Promise<void>;
|
|
109
|
+
/** Counts fresh(): a send that returns after one is dropped. */
|
|
110
|
+
private generation;
|
|
109
111
|
/** A new conversation. */
|
|
110
112
|
fresh(): void;
|
|
111
113
|
/** Sends a question; refused while a run is working (the button is "stop" then). With `refs`, the things picked by `@`. */
|
package/dist/assistant.js
CHANGED
|
@@ -33,6 +33,8 @@ export class Assistant {
|
|
|
33
33
|
this.error = null;
|
|
34
34
|
/** `client.call`s already answered (a replayed event never runs a tool twice). */
|
|
35
35
|
this.answeredCalls = new Set();
|
|
36
|
+
/** Counts fresh(): a send that returns after one is dropped. */
|
|
37
|
+
this.generation = 0;
|
|
36
38
|
this.api = new AssistantApi(host, options.base);
|
|
37
39
|
this.texts = createTexts(host.locale, options.texts);
|
|
38
40
|
this.transport = pickTransport(this.api, host, options);
|
|
@@ -81,6 +83,7 @@ export class Assistant {
|
|
|
81
83
|
}
|
|
82
84
|
/** A new conversation. */
|
|
83
85
|
fresh() {
|
|
86
|
+
this.generation++;
|
|
84
87
|
// A run still working belongs to the old conversation: it is cancelled on the server (no tokens spent on an answer
|
|
85
88
|
// nobody waits for) and dropped here — kept, it held «busy» for good and every later question was refused (a
|
|
86
89
|
// host's eval battery, 2026-11-28).
|
|
@@ -119,8 +122,15 @@ export class Assistant {
|
|
|
119
122
|
input.model = this.model;
|
|
120
123
|
if (refs?.length)
|
|
121
124
|
input.refs = refs.slice(0, 5).map(({ kind, id, label }) => ({ kind, id, label }));
|
|
125
|
+
const generation = this.generation;
|
|
122
126
|
try {
|
|
123
127
|
const t = await this.api.send(input);
|
|
128
|
+
// A new conversation began while this question was on its way: its run belongs to nobody — cancelled, not
|
|
129
|
+
// followed (else it waited on the device's tool calls for minutes; a host's eval battery, 2026-11-28).
|
|
130
|
+
if (generation !== this.generation) {
|
|
131
|
+
void this.api.cancel(t.runId).catch(() => undefined);
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
124
134
|
this.store.id = t.conversationId;
|
|
125
135
|
this.attachments = [];
|
|
126
136
|
this.follow(t.runId);
|
package/dist/i18n.js
CHANGED
|
@@ -51,14 +51,6 @@ const fa = {
|
|
|
51
51
|
"block.more_rows": "{count} ردیف دیگر",
|
|
52
52
|
"block.suggested": "پیشنهادی",
|
|
53
53
|
"block.few_data": "داده برای درصد و میانگین کافی نیست",
|
|
54
|
-
"history.today": "امروز",
|
|
55
|
-
"history.earlier": "قبلتر",
|
|
56
|
-
"history.pinned": "سنجاقشده",
|
|
57
|
-
"history.waiting": "منتظر",
|
|
58
|
-
"history.search": "جستوجو",
|
|
59
|
-
"csv.save": "ذخیره به CSV",
|
|
60
|
-
"csv.saved": "ذخیره شد",
|
|
61
|
-
"csv.not_saved": "ذخیره نشد",
|
|
62
54
|
"pdf.download": "دریافت PDF",
|
|
63
55
|
"pdf.busy": "در حال آمادهسازی PDF…",
|
|
64
56
|
"pdf.failed": "PDF ساخته نشد",
|
|
@@ -122,14 +114,6 @@ const en = {
|
|
|
122
114
|
"block.more_rows": "{count} more rows",
|
|
123
115
|
"block.suggested": "Suggested",
|
|
124
116
|
"block.few_data": "Too little data for percentages and averages",
|
|
125
|
-
"history.today": "Today",
|
|
126
|
-
"history.earlier": "Earlier",
|
|
127
|
-
"history.pinned": "Pinned",
|
|
128
|
-
"history.waiting": "Waiting",
|
|
129
|
-
"history.search": "Search",
|
|
130
|
-
"csv.save": "Save as CSV",
|
|
131
|
-
"csv.saved": "Saved",
|
|
132
|
-
"csv.not_saved": "Not saved",
|
|
133
117
|
"pdf.download": "Download PDF",
|
|
134
118
|
"pdf.busy": "Preparing the PDF…",
|
|
135
119
|
"pdf.failed": "Could not make the PDF",
|
package/dist/pages.js
CHANGED
|
@@ -67,6 +67,14 @@ const PAGE_FA = {
|
|
|
67
67
|
"composer.quick": "کارهای آماده",
|
|
68
68
|
"composer.pick": "انتخاب",
|
|
69
69
|
"history.tabs": "گفتوگوها",
|
|
70
|
+
"history.today": "امروز",
|
|
71
|
+
"history.earlier": "قبلتر",
|
|
72
|
+
"history.pinned": "سنجاقشده",
|
|
73
|
+
"history.waiting": "منتظر",
|
|
74
|
+
"history.search": "جستوجو",
|
|
75
|
+
"csv.save": "ذخیره به CSV",
|
|
76
|
+
"csv.saved": "ذخیره شد",
|
|
77
|
+
"csv.not_saved": "ذخیره نشد",
|
|
70
78
|
"history.empty": "چیزی اینجا نیست",
|
|
71
79
|
"history.untitled": "بینام",
|
|
72
80
|
"routine.list": "روالها",
|
|
@@ -141,6 +149,14 @@ const PAGE_EN = {
|
|
|
141
149
|
"composer.quick": "Ready requests",
|
|
142
150
|
"composer.pick": "Pick",
|
|
143
151
|
"history.tabs": "Conversations",
|
|
152
|
+
"history.today": "Today",
|
|
153
|
+
"history.earlier": "Earlier",
|
|
154
|
+
"history.pinned": "Pinned",
|
|
155
|
+
"history.waiting": "Waiting",
|
|
156
|
+
"history.search": "Search",
|
|
157
|
+
"csv.save": "Save as CSV",
|
|
158
|
+
"csv.saved": "Saved",
|
|
159
|
+
"csv.not_saved": "Not saved",
|
|
144
160
|
"history.empty": "Nothing here",
|
|
145
161
|
"history.untitled": "Untitled",
|
|
146
162
|
"routine.list": "Routines",
|
package/dist/types.d.ts
CHANGED
|
@@ -18,9 +18,10 @@ export declare const PARTS: readonly ["panel", "panel.header", "panel.body", "pa
|
|
|
18
18
|
* suggestion (`next`), a block's action (`action`), opening a page (`open`) or lighting a control in it (`show`), a
|
|
19
19
|
* draft's form (`draft`), a tour's steps (`tour`), a thing an answer named (`entity`), the message's small actions
|
|
20
20
|
* (`copy`, `again`, `edit`, `feedback`), the newest-message jump (`newest`), the composer's own (`send`, `stop`,
|
|
21
|
-
* `attach`, `quick`, `pick`), a card's (`confirm`, `refuse`, `card`)
|
|
21
|
+
* `attach`, `quick`, `pick`), a card's (`confirm`, `refuse`, `card`), a page's (`page`) and the Lynx model picker's
|
|
22
|
+
* (`model`, `effort`).
|
|
22
23
|
*/
|
|
23
|
-
export type ButtonRole = "next" | "action" | "open" | "show" | "draft" | "tour" | "entity" | "copy" | "again" | "edit" | "feedback" | "good" | "bad" | "reason" | "newest" | "send" | "stop" | "attach" | "mic" | "quick" | "pick" | "confirm" | "refuse" | "card" | "page";
|
|
24
|
+
export type ButtonRole = "next" | "action" | "open" | "show" | "draft" | "tour" | "entity" | "copy" | "again" | "edit" | "feedback" | "good" | "bad" | "reason" | "newest" | "send" | "stop" | "attach" | "mic" | "quick" | "pick" | "confirm" | "refuse" | "card" | "page" | "model" | "effort";
|
|
24
25
|
export type PartName = (typeof PARTS)[number];
|
|
25
26
|
/** Per-part classes and styles from the host (layer 3). */
|
|
26
27
|
export interface PartStyles {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@g9tm/aiassistant",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.6",
|
|
4
4
|
"description": "Headless client of the G9 AI assistant: API client, run state, transports, block view models, safe text and Persian helpers. No DOM, no framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@g9tm/aiassistant-contracts": "1.9.
|
|
36
|
+
"@g9tm/aiassistant-contracts": "1.9.6"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.json",
|