@things-factory/ai-assistant 10.1.213 → 10.1.215

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.
Files changed (89) hide show
  1. package/client/components/assistant-dock.ts +6 -3
  2. package/client/components/assistant-selection-bar.test.ts +42 -0
  3. package/client/components/assistant-selection-bar.ts +129 -0
  4. package/client/components/assistant-session-manager.ts +263 -12
  5. package/client/index.ts +2 -0
  6. package/client/utils/assistant-selection.test.ts +25 -1
  7. package/client/utils/assistant-selection.ts +27 -0
  8. package/client/utils/assistant-session-actions.ts +12 -0
  9. package/client/utils/assistant-session-admin.ts +70 -5
  10. package/dist-client/components/assistant-dock.js +6 -3
  11. package/dist-client/components/assistant-dock.js.map +1 -1
  12. package/dist-client/components/assistant-selection-bar.d.ts +44 -0
  13. package/dist-client/components/assistant-selection-bar.js +149 -0
  14. package/dist-client/components/assistant-selection-bar.js.map +1 -0
  15. package/dist-client/components/assistant-selection-bar.test.d.ts +1 -0
  16. package/dist-client/components/assistant-selection-bar.test.js +38 -0
  17. package/dist-client/components/assistant-selection-bar.test.js.map +1 -0
  18. package/dist-client/components/assistant-session-manager.d.ts +37 -0
  19. package/dist-client/components/assistant-session-manager.js +281 -13
  20. package/dist-client/components/assistant-session-manager.js.map +1 -1
  21. package/dist-client/index.d.ts +1 -0
  22. package/dist-client/index.js +2 -0
  23. package/dist-client/index.js.map +1 -1
  24. package/dist-client/tsconfig.tsbuildinfo +1 -1
  25. package/dist-client/utils/assistant-selection.d.ts +24 -0
  26. package/dist-client/utils/assistant-selection.js +24 -0
  27. package/dist-client/utils/assistant-selection.js.map +1 -1
  28. package/dist-client/utils/assistant-selection.test.js +21 -1
  29. package/dist-client/utils/assistant-selection.test.js.map +1 -1
  30. package/dist-client/utils/assistant-session-actions.d.ts +15 -0
  31. package/dist-client/utils/assistant-session-actions.js +11 -0
  32. package/dist-client/utils/assistant-session-actions.js.map +1 -1
  33. package/dist-client/utils/assistant-session-admin.d.ts +32 -1
  34. package/dist-client/utils/assistant-session-admin.js +36 -5
  35. package/dist-client/utils/assistant-session-admin.js.map +1 -1
  36. package/dist-server/service/assistant-chat-resolver.js +6 -4
  37. package/dist-server/service/assistant-chat-resolver.js.map +1 -1
  38. package/dist-server/service/assistant-mode/index.d.ts +1 -1
  39. package/dist-server/service/assistant-mode/index.js +2 -1
  40. package/dist-server/service/assistant-mode/index.js.map +1 -1
  41. package/dist-server/service/assistant-mode/mode-categories.d.ts +30 -0
  42. package/dist-server/service/assistant-mode/mode-categories.js +35 -2
  43. package/dist-server/service/assistant-mode/mode-categories.js.map +1 -1
  44. package/dist-server/service/chat-session/session-cleanup.d.ts +28 -0
  45. package/dist-server/service/chat-session/session-cleanup.js +69 -0
  46. package/dist-server/service/chat-session/session-cleanup.js.map +1 -0
  47. package/dist-server/service/chat-session/session-inbox.d.ts +15 -0
  48. package/dist-server/service/chat-session/session-inbox.js +11 -0
  49. package/dist-server/service/chat-session/session-inbox.js.map +1 -1
  50. package/dist-server/service/chat-session/session-purge.d.ts +4 -0
  51. package/dist-server/service/chat-session/session-purge.js +45 -11
  52. package/dist-server/service/chat-session/session-purge.js.map +1 -1
  53. package/dist-server/service/chat-session-resolver.d.ts +24 -2
  54. package/dist-server/service/chat-session-resolver.js +193 -13
  55. package/dist-server/service/chat-session-resolver.js.map +1 -1
  56. package/dist-server/service/data-read/list-read.d.ts +3 -1
  57. package/dist-server/service/data-read/list-read.js +27 -2
  58. package/dist-server/service/data-read/list-read.js.map +1 -1
  59. package/dist-server/service/data-read/read-target.d.ts +16 -0
  60. package/dist-server/service/data-read/read-target.js +18 -1
  61. package/dist-server/service/data-read/read-target.js.map +1 -1
  62. package/dist-server/service/data-read/read-tools.js +3 -1
  63. package/dist-server/service/data-read/read-tools.js.map +1 -1
  64. package/dist-server/tsconfig.tsbuildinfo +1 -1
  65. package/package.json +6 -6
  66. package/server/service/assistant-chat-resolver.ts +7 -5
  67. package/server/service/assistant-mode/conversation-category.test.ts +15 -2
  68. package/server/service/assistant-mode/index.ts +1 -1
  69. package/server/service/assistant-mode/mode-categories.ts +48 -2
  70. package/server/service/assistant-mode/mode-front.test.ts +27 -1
  71. package/server/service/assistant-mode/open-subject-door.test.ts +3 -1
  72. package/server/service/chat-session/session-cleanup.test.ts +83 -0
  73. package/server/service/chat-session/session-cleanup.ts +69 -0
  74. package/server/service/chat-session/session-inbox.ts +13 -0
  75. package/server/service/chat-session/session-purge.ts +46 -10
  76. package/server/service/chat-session-resolver.ts +150 -14
  77. package/server/service/data-read/list-read.ts +30 -3
  78. package/server/service/data-read/list-status.test.ts +46 -0
  79. package/server/service/data-read/read-target.ts +32 -1
  80. package/server/service/data-read/read-tools.ts +2 -1
  81. package/test/assistant-dock.test.ts +12 -1
  82. package/test/assistant-session-manager.test.ts +53 -1
  83. package/test/open-doors.test.ts +3 -1
  84. package/translations/en.json +45 -2
  85. package/translations/es.json +45 -2
  86. package/translations/ja.json +45 -2
  87. package/translations/ko.json +45 -2
  88. package/translations/ms.json +45 -2
  89. package/translations/zh.json +45 -2
@@ -0,0 +1,44 @@
1
+ import { LitElement, nothing } from 'lit';
2
+ /** The part of a grid (data-grist `ox-grist`) the bar reads. */
3
+ export interface SelectionGrid extends HTMLElement {
4
+ selected?: any[];
5
+ updateComplete?: Promise<unknown>;
6
+ }
7
+ /**
8
+ * 「AI와 작업」 over a list - one bar for every application's lists (design/ai/shared-dock.md §2-11-1). While rows are
9
+ * picked it shows how many, what the list itself does with them, and a request sent to this screen's conversation with
10
+ * the rows as the selection. Begun on the Office ledgers; the user, 2026-10-25: 「'AI와 작업' 기능을 사용하려면, 그리드
11
+ * 선택기능이 필요한데, 주요 리스트 화면에서 선택기능이 없는 경우가 꽤 있다」, and it is to serve plant, warehouse and twin.
12
+ *
13
+ * A screen gives the grid (asked for when needed - a page finds its grid only after its first render), the list as the
14
+ * person knows it, the list query and its axis (the last part of the list's read key, so a row goes as `<axis>:<uuid>`),
15
+ * and, if it likes, its own actions and words for a row. The grid shows `SELECTION_ROW_PICKER`.
16
+ */
17
+ export declare class OxAssistantSelectionBar extends LitElement {
18
+ static styles: import("lit").CSSResult[];
19
+ /** The grid whose picked rows these are, asked for when needed. */
20
+ gridOf?: () => SelectionGrid | undefined;
21
+ /** The list as the person knows it (「계약 대장」). */
22
+ name: string;
23
+ /** The list query the rows came from (`contracts`) - one the assistant reads. */
24
+ list: string;
25
+ /** The last part of that list's read key (`office.contract` → `contract`): each row goes as `<axis>:<uuid>`. */
26
+ axis: string;
27
+ /** What the list itself does with the picked rows, before 「AI와 작업」. */
28
+ actions: {
29
+ title: string;
30
+ action: () => any;
31
+ }[];
32
+ /** A row in the person's words, when the code and name do not say it (`selectionLabel`). */
33
+ labelOf?: (row: any) => string;
34
+ count: number;
35
+ request: string;
36
+ private get grid();
37
+ private root?;
38
+ private recount;
39
+ connectedCallback(): void;
40
+ disconnectedCallback(): void;
41
+ willUpdate(changes: Map<string, unknown>): void;
42
+ ask(request?: string): Promise<void>;
43
+ render(): import("lit-html").TemplateResult<1> | typeof nothing;
44
+ }
@@ -0,0 +1,149 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { css, html, LitElement, nothing } from 'lit';
3
+ import { customElement, property, state } from 'lit/decorators.js';
4
+ import { i18next } from '@operato/i18n';
5
+ import { notify } from '@operato/layout';
6
+ import { ButtonStyles, FormFieldStyles } from '@operato/styles';
7
+ import { askAssistant } from '../utils/assistant-ask.js';
8
+ import { selectedRecords } from '../utils/assistant-selection.js';
9
+ /** What a grid says when its picks or its rows change - a row's picker, the header's select-all, a new page of rows. */
10
+ const GRID_EVENTS = ['select-record-change', 'select-all-change', 'list-adopted'];
11
+ /**
12
+ * 「AI와 작업」 over a list - one bar for every application's lists (design/ai/shared-dock.md §2-11-1). While rows are
13
+ * picked it shows how many, what the list itself does with them, and a request sent to this screen's conversation with
14
+ * the rows as the selection. Begun on the Office ledgers; the user, 2026-10-25: 「'AI와 작업' 기능을 사용하려면, 그리드
15
+ * 선택기능이 필요한데, 주요 리스트 화면에서 선택기능이 없는 경우가 꽤 있다」, and it is to serve plant, warehouse and twin.
16
+ *
17
+ * A screen gives the grid (asked for when needed - a page finds its grid only after its first render), the list as the
18
+ * person knows it, the list query and its axis (the last part of the list's read key, so a row goes as `<axis>:<uuid>`),
19
+ * and, if it likes, its own actions and words for a row. The grid shows `SELECTION_ROW_PICKER`.
20
+ */
21
+ let OxAssistantSelectionBar = class OxAssistantSelectionBar extends LitElement {
22
+ constructor() {
23
+ super(...arguments);
24
+ /** The list as the person knows it (「계약 대장」). */
25
+ this.name = '';
26
+ /** The list query the rows came from (`contracts`) - one the assistant reads. */
27
+ this.list = '';
28
+ /** The last part of that list's read key (`office.contract` → `contract`): each row goes as `<axis>:<uuid>`. */
29
+ this.axis = '';
30
+ /** What the list itself does with the picked rows, before 「AI와 작업」. */
31
+ this.actions = [];
32
+ this.count = 0;
33
+ this.request = '';
34
+ this.recount = async (event) => {
35
+ const grid = this.grid;
36
+ if (event && (!grid || !event.composedPath().includes(grid)))
37
+ return;
38
+ await grid?.updateComplete;
39
+ this.count = grid?.selected?.length ?? 0;
40
+ };
41
+ }
42
+ static { this.styles = [
43
+ ButtonStyles,
44
+ FormFieldStyles,
45
+ css `
46
+ :host { display:block; }
47
+ .selection-work { display:flex; flex-wrap:wrap; align-items:center; gap:var(--spacing-medium); padding:var(--spacing-medium) var(--spacing-large); border-bottom:1px solid var(--ui-line); background:var(--ui-panel); }
48
+ .scope { font-size:var(--ui-t-body); font-weight:600; white-space:nowrap; }
49
+ form { display:flex; flex:1 1 320px; min-width:0; gap:var(--spacing-small); }
50
+ input { flex:1; min-width:0; width:100%; }
51
+ .tools { display:flex; flex-wrap:wrap; gap:var(--spacing-small); }
52
+ `
53
+ ]; }
54
+ get grid() {
55
+ return this.gridOf?.();
56
+ }
57
+ connectedCallback() {
58
+ super.connectedCallback();
59
+ this.root = this.getRootNode();
60
+ for (const event of GRID_EVENTS)
61
+ this.root.addEventListener(event, this.recount);
62
+ void this.recount();
63
+ }
64
+ disconnectedCallback() {
65
+ super.disconnectedCallback();
66
+ for (const event of GRID_EVENTS)
67
+ this.root?.removeEventListener(event, this.recount);
68
+ this.root = undefined;
69
+ }
70
+ willUpdate(changes) {
71
+ if (changes.has('gridOf'))
72
+ void this.recount();
73
+ }
74
+ /*
75
+ * A screen request (design/ai/shared-dock.md §2-11-1, the user: 「"AI와 작업" 기능이 unstable 하다 … 새로운 세션을 여는지,
76
+ * 기존 세션을 활용하는지 등등을 명확하게 하라」): it goes to this screen's conversation with the rows picked now, in
77
+ * screen order, and is sent at once - what was written on the bar, or the set request. The bar is cleared only when it
78
+ * was sent; otherwise the dock has said why and the words stay to press again.
79
+ */
80
+ async ask(request = this.request) {
81
+ const rows = this.grid?.selected ?? [];
82
+ if (!rows.length) {
83
+ notify({ message: i18next.t('ai-assistant.selection.pick-rows'), level: 'info' });
84
+ return;
85
+ }
86
+ if (rows.some(row => !row.id || row.__dirty__)) {
87
+ notify({ message: i18next.t('ai-assistant.selection.save-first'), level: 'warn' });
88
+ return;
89
+ }
90
+ const outcome = await askAssistant({
91
+ selection: { title: this.name, list: this.list, records: selectedRecords(rows, { axis: this.axis, labelOf: this.labelOf }) },
92
+ ask: request?.trim() || i18next.t('ai-assistant.selection.ask', { n: rows.length, title: this.name })
93
+ });
94
+ if (outcome?.sent && this.request === request)
95
+ this.request = '';
96
+ }
97
+ render() {
98
+ return this.count
99
+ ? html `<div class="selection-work" role="region" aria-label=${i18next.t('ai-assistant.selection.region')}>
100
+ <span class="scope" role="status">${i18next.t('ai-assistant.selection.count', { n: this.count })}</span>
101
+ ${this.actions.length
102
+ ? html `<div class="tools">${this.actions.map(action => html `<button quiet small @click=${action.action}>${action.title}</button>`)}</div>`
103
+ : nothing}
104
+ <form @submit=${(event) => { event.preventDefault(); this.ask(); }}>
105
+ <input aria-label=${i18next.t('ai-assistant.selection.request')} placeholder=${i18next.t('ai-assistant.selection.request')}
106
+ .value=${this.request} @input=${(event) => (this.request = event.target.value)} />
107
+ <button quiet small type="submit">${i18next.t('ai-assistant.selection.work-with-ai')}</button>
108
+ </form>
109
+ </div>`
110
+ : nothing;
111
+ }
112
+ };
113
+ __decorate([
114
+ property({ attribute: false }),
115
+ __metadata("design:type", Function)
116
+ ], OxAssistantSelectionBar.prototype, "gridOf", void 0);
117
+ __decorate([
118
+ property(),
119
+ __metadata("design:type", Object)
120
+ ], OxAssistantSelectionBar.prototype, "name", void 0);
121
+ __decorate([
122
+ property(),
123
+ __metadata("design:type", Object)
124
+ ], OxAssistantSelectionBar.prototype, "list", void 0);
125
+ __decorate([
126
+ property(),
127
+ __metadata("design:type", Object)
128
+ ], OxAssistantSelectionBar.prototype, "axis", void 0);
129
+ __decorate([
130
+ property({ attribute: false }),
131
+ __metadata("design:type", Array)
132
+ ], OxAssistantSelectionBar.prototype, "actions", void 0);
133
+ __decorate([
134
+ property({ attribute: false }),
135
+ __metadata("design:type", Function)
136
+ ], OxAssistantSelectionBar.prototype, "labelOf", void 0);
137
+ __decorate([
138
+ state(),
139
+ __metadata("design:type", Object)
140
+ ], OxAssistantSelectionBar.prototype, "count", void 0);
141
+ __decorate([
142
+ state(),
143
+ __metadata("design:type", Object)
144
+ ], OxAssistantSelectionBar.prototype, "request", void 0);
145
+ OxAssistantSelectionBar = __decorate([
146
+ customElement('ox-assistant-selection-bar')
147
+ ], OxAssistantSelectionBar);
148
+ export { OxAssistantSelectionBar };
149
+ //# sourceMappingURL=assistant-selection-bar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assistant-selection-bar.js","sourceRoot":"","sources":["../../client/components/assistant-selection-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OA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AE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;gDACjD,OAAO,CAAC,CAAC,CAAC,qCAAqC,CAAC;;eAEjF;YACT,CAAC,CAAC,OAAO,CAAA;IACb,CAAC;;AAlF+B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;uDAAyC;AAE5D;IAAX,QAAQ,EAAE;;qDAAU;AAET;IAAX,QAAQ,EAAE;;qDAAU;AAET;IAAX,QAAQ,EAAE;;qDAAU;AAEW;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;wDAAqD;AAEpD;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;wDAA+B;AAErD;IAAR,KAAK,EAAE;;sDAAU;AACT;IAAR,KAAK,EAAE;;wDAAa;AA5BV,uBAAuB;IADnC,aAAa,CAAC,4BAA4B,CAAC;GAC/B,uBAAuB,CAkGnC","sourcesContent":["import { css, html, LitElement, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\nimport { notify } from '@operato/layout'\nimport { ButtonStyles, FormFieldStyles } from '@operato/styles'\n\nimport { askAssistant } from '../utils/assistant-ask.js'\nimport { selectedRecords } from '../utils/assistant-selection.js'\n\n/** What a grid says when its picks or its rows change - a row's picker, the header's select-all, a new page of rows. */\nconst GRID_EVENTS = ['select-record-change', 'select-all-change', 'list-adopted']\n\n/** The part of a grid (data-grist `ox-grist`) the bar reads. */\nexport interface SelectionGrid extends HTMLElement {\n selected?: any[]\n updateComplete?: Promise<unknown>\n}\n\n/**\n * 「AI와 작업」 over a list - one bar for every application's lists (design/ai/shared-dock.md §2-11-1). While rows are\n * picked it shows how many, what the list itself does with them, and a request sent to this screen's conversation with\n * the rows as the selection. Begun on the Office ledgers; the user, 2026-10-25: 「'AI와 작업' 기능을 사용하려면, 그리드\n * 선택기능이 필요한데, 주요 리스트 화면에서 선택기능이 없는 경우가 꽤 있다」, and it is to serve plant, warehouse and twin.\n *\n * A screen gives the grid (asked for when needed - a page finds its grid only after its first render), the list as the\n * person knows it, the list query and its axis (the last part of the list's read key, so a row goes as `<axis>:<uuid>`),\n * and, if it likes, its own actions and words for a row. The grid shows `SELECTION_ROW_PICKER`.\n */\n@customElement('ox-assistant-selection-bar')\nexport class OxAssistantSelectionBar extends LitElement {\n static styles = [\n ButtonStyles,\n FormFieldStyles,\n css`\n :host { display:block; }\n .selection-work { display:flex; flex-wrap:wrap; align-items:center; gap:var(--spacing-medium); padding:var(--spacing-medium) var(--spacing-large); border-bottom:1px solid var(--ui-line); background:var(--ui-panel); }\n .scope { font-size:var(--ui-t-body); font-weight:600; white-space:nowrap; }\n form { display:flex; flex:1 1 320px; min-width:0; gap:var(--spacing-small); }\n input { flex:1; min-width:0; width:100%; }\n .tools { display:flex; flex-wrap:wrap; gap:var(--spacing-small); }\n `\n ]\n\n /** The grid whose picked rows these are, asked for when needed. */\n @property({ attribute: false }) gridOf?: () => SelectionGrid | undefined\n /** The list as the person knows it (「계약 대장」). */\n @property() name = ''\n /** The list query the rows came from (`contracts`) - one the assistant reads. */\n @property() list = ''\n /** The last part of that list's read key (`office.contract` → `contract`): each row goes as `<axis>:<uuid>`. */\n @property() axis = ''\n /** What the list itself does with the picked rows, before 「AI와 작업」. */\n @property({ attribute: false }) actions: { title: string; action: () => any }[] = []\n /** A row in the person's words, when the code and name do not say it (`selectionLabel`). */\n @property({ attribute: false }) labelOf?: (row: any) => string\n\n @state() count = 0\n @state() request = ''\n\n private get grid() {\n return this.gridOf?.()\n }\n\n /* The grid's own events reach the page's root (bubbling, composed); the bar counts those that come from its grid. */\n private root?: Node\n private recount = async (event?: Event) => {\n const grid = this.grid\n if (event && (!grid || !event.composedPath().includes(grid))) return\n await grid?.updateComplete\n this.count = grid?.selected?.length ?? 0\n }\n\n connectedCallback() {\n super.connectedCallback()\n this.root = this.getRootNode()\n for (const event of GRID_EVENTS) this.root.addEventListener(event, this.recount)\n void this.recount()\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n for (const event of GRID_EVENTS) this.root?.removeEventListener(event, this.recount)\n this.root = undefined\n }\n\n willUpdate(changes: Map<string, unknown>) {\n if (changes.has('gridOf')) void this.recount()\n }\n\n /*\n * A screen request (design/ai/shared-dock.md §2-11-1, the user: 「\"AI와 작업\" 기능이 unstable 하다 … 새로운 세션을 여는지,\n * 기존 세션을 활용하는지 등등을 명확하게 하라」): it goes to this screen's conversation with the rows picked now, in\n * screen order, and is sent at once - what was written on the bar, or the set request. The bar is cleared only when it\n * was sent; otherwise the dock has said why and the words stay to press again.\n */\n async ask(request: string = this.request) {\n const rows = this.grid?.selected ?? []\n if (!rows.length) {\n notify({ message: i18next.t('ai-assistant.selection.pick-rows'), level: 'info' })\n return\n }\n if (rows.some(row => !row.id || row.__dirty__)) {\n notify({ message: i18next.t('ai-assistant.selection.save-first'), level: 'warn' })\n return\n }\n const outcome = await askAssistant({\n selection: { title: this.name, list: this.list, records: selectedRecords(rows, { axis: this.axis, labelOf: this.labelOf }) },\n ask: request?.trim() || i18next.t('ai-assistant.selection.ask', { n: rows.length, title: this.name })\n })\n if (outcome?.sent && this.request === request) this.request = ''\n }\n\n render() {\n return this.count\n ? html`<div class=\"selection-work\" role=\"region\" aria-label=${i18next.t('ai-assistant.selection.region')}>\n <span class=\"scope\" role=\"status\">${i18next.t('ai-assistant.selection.count', { n: this.count })}</span>\n ${this.actions.length\n ? html`<div class=\"tools\">${this.actions.map(action => html`<button quiet small @click=${action.action}>${action.title}</button>`)}</div>`\n : nothing}\n <form @submit=${(event: Event) => { event.preventDefault(); this.ask() }}>\n <input aria-label=${i18next.t('ai-assistant.selection.request')} placeholder=${i18next.t('ai-assistant.selection.request')}\n .value=${this.request} @input=${(event: any) => (this.request = event.target.value)} />\n <button quiet small type=\"submit\">${i18next.t('ai-assistant.selection.work-with-ai')}</button>\n </form>\n </div>`\n : nothing\n }\n}\n"]}
@@ -0,0 +1,38 @@
1
+ /*
2
+ * 「AI와 작업」 over a list (ox-assistant-selection-bar) - one bar for every application's lists. What it is held to here is
3
+ * its source and its words; its behaviour on a real grid is held by the applications' browser tests (operato-office
4
+ * test/browser/page-ai-input.test.js).
5
+ */
6
+ import { readFileSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ const bare = readFileSync(join(__dirname, 'assistant-selection-bar.ts'), 'utf-8').replace(/\/\*[\s\S]*?\*\//g, '');
9
+ describe('the selection bar', () => {
10
+ it('★ counts every way a grid picks - a row, the header\'s select-all, a new page of rows', () => {
11
+ expect(bare).toMatch(/GRID_EVENTS = \['select-record-change', 'select-all-change', 'list-adopted'\]/);
12
+ });
13
+ it('★ asks for its grid when it needs it - a page finds its grid only after its first render', () => {
14
+ expect(bare).toMatch(/gridOf\?: \(\) => SelectionGrid \| undefined/);
15
+ expect(bare).not.toMatch(/@property\(\{ attribute: false \}\) grist/);
16
+ });
17
+ it('★ hands the rows as keys of the list, to this screen\'s conversation, sent at once', () => {
18
+ expect(bare).toMatch(/selection: \{ title: this\.name, list: this\.list, records: selectedRecords\(rows, \{ axis: this\.axis, labelOf: this\.labelOf \}\) \}/);
19
+ expect(bare).toMatch(/ask: request\?\.trim\(\) \|\| i18next\.t\('ai-assistant\.selection\.ask'/);
20
+ expect(bare).not.toMatch(/draft|continueCurrent|transcript/);
21
+ });
22
+ it('keeps the words unless the request was sent', () => {
23
+ expect(bare).toMatch(/if \(outcome\?\.sent && this\.request === request\) this\.request = ''/);
24
+ });
25
+ it('every word it shows reads in every language', () => {
26
+ const keys = [...new Set([...bare.matchAll(/'(ai-assistant\.selection\.[\w-]+)'/g)].map(([, key]) => key))];
27
+ expect(keys.length).toBe(7);
28
+ for (const locale of ['en', 'ko', 'ja', 'zh', 'ms', 'es']) {
29
+ const words = JSON.parse(readFileSync(join(__dirname, `../../translations/${locale}.json`), 'utf-8'));
30
+ for (const key of keys)
31
+ expect([locale, key, typeof words[key]]).toEqual([locale, key, 'string']);
32
+ expect(words['ai-assistant.selection.ask']).toMatch(/\{n\}/);
33
+ expect(words['ai-assistant.selection.ask']).toMatch(/\{title\}/);
34
+ expect(words['ai-assistant.selection.count']).toMatch(/\{n\}/);
35
+ }
36
+ });
37
+ });
38
+ //# sourceMappingURL=assistant-selection-bar.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assistant-selection-bar.test.js","sourceRoot":"","sources":["../../client/components/assistant-selection-bar.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,4BAA4B,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAA;AAElH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,uFAAuF,EAAE,GAAG,EAAE;QAC/F,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,+EAA+E,CAAC,CAAA;IACvG,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,0FAA0F,EAAE,GAAG,EAAE;QAClG,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,8CAA8C,CAAC,CAAA;QACpE,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,2CAA2C,CAAC,CAAA;IACvE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oFAAoF,EAAE,GAAG,EAAE;QAC5F,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,wIAAwI,CAAC,CAAA;QAC9J,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,0EAA0E,CAAC,CAAA;QAChG,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,kCAAk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A;QAChE,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/*\n * 「AI와 작업」 over a list (ox-assistant-selection-bar) - one bar for every application's lists. What it is held to here is\n * its source and its words; its behaviour on a real grid is held by the applications' browser tests (operato-office\n * test/browser/page-ai-input.test.js).\n */\nimport { readFileSync } from 'node:fs'\nimport { join } from 'node:path'\n\nconst bare = readFileSync(join(__dirname, 'assistant-selection-bar.ts'), 'utf-8').replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n\ndescribe('the selection bar', () => {\n it('★ counts every way a grid picks - a row, the header\\'s select-all, a new page of rows', () => {\n expect(bare).toMatch(/GRID_EVENTS = \\['select-record-change', 'select-all-change', 'list-adopted'\\]/)\n })\n\n it('★ asks for its grid when it needs it - a page finds its grid only after its first render', () => {\n expect(bare).toMatch(/gridOf\\?: \\(\\) => SelectionGrid \\| undefined/)\n expect(bare).not.toMatch(/@property\\(\\{ attribute: false \\}\\) grist/)\n })\n\n it('★ hands the rows as keys of the list, to this screen\\'s conversation, sent at once', () => {\n expect(bare).toMatch(/selection: \\{ title: this\\.name, list: this\\.list, records: selectedRecords\\(rows, \\{ axis: this\\.axis, labelOf: this\\.labelOf \\}\\) \\}/)\n expect(bare).toMatch(/ask: request\\?\\.trim\\(\\) \\|\\| i18next\\.t\\('ai-assistant\\.selection\\.ask'/)\n expect(bare).not.toMatch(/draft|continueCurrent|transcript/)\n })\n\n it('keeps the words unless the request was sent', () => {\n expect(bare).toMatch(/if \\(outcome\\?\\.sent && this\\.request === request\\) this\\.request = ''/)\n })\n\n it('every word it shows reads in every language', () => {\n const keys = [...new Set([...bare.matchAll(/'(ai-assistant\\.selection\\.[\\w-]+)'/g)].map(([, key]) => key))]\n expect(keys.length).toBe(7)\n for (const locale of ['en', 'ko', 'ja', 'zh', 'ms', 'es']) {\n const words = JSON.parse(readFileSync(join(__dirname, `../../translations/${locale}.json`), 'utf-8'))\n for (const key of keys) expect([locale, key, typeof words[key]]).toEqual([locale, key, 'string'])\n expect(words['ai-assistant.selection.ask']).toMatch(/\\{n\\}/)\n expect(words['ai-assistant.selection.ask']).toMatch(/\\{title\\}/)\n expect(words['ai-assistant.selection.count']).toMatch(/\\{n\\}/)\n }\n })\n})\n"]}
@@ -25,6 +25,10 @@ import { type AssistantSessionAdmin } from '../utils/assistant-session-admin.js'
25
25
  * ── Asking before what cannot be undone ─────────────────────────────────────────
26
26
  * Delete, and opening a private conversation to the domain, ask on the row itself - [Cancel][OK].
27
27
  * Making it private, hiding and renaming do not: each can be undone from the same row.
28
+ *
29
+ * ── Many at once (2026-10-25, the user: 「멀티셀렉트로 한번에 지울 수 있게」) ──────────
30
+ * Each row has a box; the picked ones are deleted, left or hidden together, each by its own row's hints
31
+ * (`bulkActions`), with one question. A deleted one is kept for `deletedDays` and comes back from 「Deleted」.
28
32
  */
29
33
  export declare class AssistantSessionManager extends LitElement {
30
34
  static styles: import("lit").CSSResult;
@@ -49,12 +53,28 @@ export declare class AssistantSessionManager extends LitElement {
49
53
  private loading;
50
54
  private error;
51
55
  private renamingId;
56
+ private view;
57
+ private archivedCount;
58
+ private cleanupCount;
59
+ private keeping;
60
+ private deleted;
61
+ /** The rows picked for doing at once - ids, kept across a reload for the rows still listed. */
62
+ private picked;
63
+ private busy;
64
+ /** What was just done, said once - and the conversation brought back, to open it from here. */
65
+ private notice;
66
+ /** The suggestions arrive picked - set when the view turns to them, spent by the first read. */
67
+ private pickAllOnRead;
52
68
  private get filtering();
53
69
  private clearFilters;
54
70
  private generation;
55
71
  private searchTimer?;
56
72
  /** Read the list again - the host calls this after it opened or started a conversation. */
57
73
  reload(): Promise<void>;
74
+ /** After a read: the suggestions arrive all picked; otherwise only the picked rows still listed stay picked. */
75
+ private keepPicked;
76
+ private setView;
77
+ private togglePick;
58
78
  protected updated(changed: PropertyValues): void;
59
79
  disconnectedCallback(): void;
60
80
  private emit;
@@ -68,7 +88,24 @@ export declare class AssistantSessionManager extends LitElement {
68
88
  private setHidden;
69
89
  private setVisibility;
70
90
  private _removeSession;
91
+ /**
92
+ * Runs one door for each picked row, then reads the list again. Every success is told to the host like a row's own
93
+ * change, so it moves off an open conversation that went; every refusal is said by name.
94
+ */
95
+ private runMany;
96
+ /** The sentence that says a deleted conversation can still come back - from 「Deleted」, for as long as it is kept. */
97
+ private keptFor;
98
+ private askRemoveMany;
99
+ private askLeaveMany;
100
+ private hideMany;
101
+ private restoreMany;
102
+ private restoreOne;
71
103
  render(): TemplateResult;
104
+ /** The box over the list: pick all, and what the picked ones can have done to them together. */
105
+ private renderPickBar;
106
+ private renderDeletedRow;
107
+ /** Why a row is where it is: archived, or suggested for clearing. */
108
+ private renderState;
72
109
  private renderRow;
73
110
  /**
74
111
  * A row's actions in the platform's popup menu - one open at a time, closed by a press outside or Escape, placed