@celljs/ta-web 4.24.1 → 4.26.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/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/account/account-side.js +3 -1
- package/esm/browser/assistant/assistant-task-source.js +3 -1
- package/esm/browser/assistant/assistant-thread.d.ts +5 -2
- package/esm/browser/assistant/assistant-thread.js +70 -46
- package/esm/browser/assistant/assistant-view.js +9 -3
- package/esm/browser/components/account-menu.d.ts +2 -1
- package/esm/browser/components/account-menu.js +12 -3
- package/esm/browser/components/app-nav.js +5 -5
- package/esm/browser/components/chat-asks.js +16 -1
- package/esm/browser/components/chat-home.d.ts +7 -2
- package/esm/browser/components/chat-home.js +2 -2
- package/esm/browser/components/chat-icon.d.ts +6 -1
- package/esm/browser/components/chat-icon.js +45 -4
- package/esm/browser/components/chat-list-hooks.d.ts +10 -0
- package/esm/browser/components/chat-list-hooks.js +15 -0
- package/esm/browser/components/chat-list.js +7 -9
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/composer-addon-util.d.ts +5 -0
- package/esm/browser/components/composer-addon-util.js +17 -0
- package/esm/browser/components/composer-addons.d.ts +3 -1
- package/esm/browser/components/composer-addons.js +5 -2
- package/esm/browser/components/editor-actions.d.ts +10 -0
- package/esm/browser/components/editor-actions.js +13 -0
- package/esm/browser/components/editor-area.js +8 -4
- package/esm/browser/components/fold-text.d.ts +4 -2
- package/esm/browser/components/fold-text.js +5 -4
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/image-swipe.d.ts +20 -0
- package/esm/browser/components/image-swipe.js +75 -0
- package/esm/browser/components/image-viewer.d.ts +2 -2
- package/esm/browser/components/image-viewer.js +2 -2
- package/esm/browser/components/message-footer.d.ts +2 -2
- package/esm/browser/components/message-footer.js +2 -2
- package/esm/browser/components/message-list.d.ts +12 -0
- package/esm/browser/components/message-list.js +31 -18
- package/esm/browser/components/message-user.js +5 -3
- package/esm/browser/components/nav-places.d.ts +2 -1
- package/esm/browser/components/nav-places.js +3 -2
- package/esm/browser/components/relay-services.d.ts +1 -1
- package/esm/browser/components/relay-services.js +11 -91
- package/esm/browser/components/said-text.d.ts +6 -2
- package/esm/browser/components/said-text.js +8 -2
- package/esm/browser/components/serve-restart.d.ts +11 -2
- package/esm/browser/components/serve-restart.js +64 -3
- package/esm/browser/components/session-view.js +3 -2
- package/esm/browser/components/settings-more.js +7 -4
- package/esm/browser/components/workbench-tabs.d.ts +4 -2
- package/esm/browser/components/workbench-tabs.js +5 -3
- package/esm/browser/extension/extension-view.d.ts +9 -1
- package/esm/browser/extension/extension-view.js +12 -1
- package/esm/browser/extension/icons.js +10 -1
- package/esm/browser/extension/web-api-contributions.d.ts +19 -14
- package/esm/browser/extension/web-api-editors.d.ts +32 -0
- package/esm/browser/extension/web-api-editors.js +2 -0
- package/esm/browser/extension/web-api-menus.d.ts +40 -0
- package/esm/browser/extension/web-api-menus.js +2 -0
- package/esm/browser/extension/web-api-partners.d.ts +6 -0
- package/esm/browser/extension/web-extension-api.d.ts +9 -26
- package/esm/browser/extension/web-extension-context.js +5 -9
- package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
- package/esm/browser/extension/web-extension-protocol.js +1 -0
- package/esm/browser/extension/web-extension-run.d.ts +5 -2
- package/esm/browser/extension/web-extension-run.js +15 -0
- package/esm/browser/extension/web-home.js +8 -0
- package/esm/browser/extension/web-session-notices.js +8 -0
- package/esm/browser/i18n/locales.d.ts +12 -1
- package/esm/browser/i18n/messages-ja.js +13 -2
- package/esm/browser/i18n/messages-zh-tw.js +13 -2
- package/esm/browser/i18n/messages.d.ts +11 -0
- package/esm/browser/i18n/messages.js +27 -5
- package/esm/browser/notices/chime.d.ts +16 -0
- package/esm/browser/notices/chime.js +67 -0
- package/esm/browser/notices/session-notices.d.ts +8 -0
- package/esm/browser/notices/session-notices.js +23 -2
- package/esm/browser/share/shared-page.js +2 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +5 -3
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation-column.js +2 -2
- package/esm/browser/style/device.js +2 -2
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +9 -1
- package/esm/browser/style/shared.d.ts +1 -1
- package/esm/browser/style/shared.js +1 -0
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +7 -4
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style/tasks.js +1 -1
- package/esm/browser/util/image-swipe.d.ts +14 -3
- package/esm/browser/util/image-swipe.js +26 -3
- package/esm/browser/util/process.d.ts +5 -0
- package/esm/browser/util/process.js +22 -1
- package/esm/browser/workbench-protocol.d.ts +5 -0
- package/esm/browser/workbench.d.ts +1 -0
- package/esm/browser/workbench.js +20 -0
- package/lib/browser/account/account-side.js +3 -1
- package/lib/browser/assistant/assistant-task-source.js +3 -1
- package/lib/browser/assistant/assistant-thread.d.ts +5 -2
- package/lib/browser/assistant/assistant-thread.js +70 -46
- package/lib/browser/assistant/assistant-view.js +8 -2
- package/lib/browser/components/account-menu.d.ts +2 -1
- package/lib/browser/components/account-menu.js +10 -1
- package/lib/browser/components/app-nav.js +4 -4
- package/lib/browser/components/chat-asks.js +16 -1
- package/lib/browser/components/chat-home.d.ts +7 -2
- package/lib/browser/components/chat-home.js +2 -2
- package/lib/browser/components/chat-icon.d.ts +6 -1
- package/lib/browser/components/chat-icon.js +45 -4
- package/lib/browser/components/chat-list-hooks.d.ts +10 -0
- package/lib/browser/components/chat-list-hooks.js +16 -0
- package/lib/browser/components/chat-list.js +6 -8
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/composer-addon-util.d.ts +5 -0
- package/lib/browser/components/composer-addon-util.js +17 -0
- package/lib/browser/components/composer-addons.d.ts +3 -1
- package/lib/browser/components/composer-addons.js +5 -2
- package/lib/browser/components/editor-actions.d.ts +11 -0
- package/lib/browser/components/editor-actions.js +50 -0
- package/lib/browser/components/editor-area.js +7 -3
- package/lib/browser/components/fold-text.d.ts +4 -2
- package/lib/browser/components/fold-text.js +5 -4
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/image-swipe.d.ts +20 -0
- package/lib/browser/components/image-swipe.js +75 -0
- package/lib/browser/components/image-viewer.d.ts +2 -2
- package/lib/browser/components/image-viewer.js +2 -2
- package/lib/browser/components/message-footer.d.ts +2 -2
- package/lib/browser/components/message-footer.js +3 -4
- package/lib/browser/components/message-list.d.ts +12 -0
- package/lib/browser/components/message-list.js +32 -18
- package/lib/browser/components/message-user.js +5 -3
- package/lib/browser/components/nav-places.d.ts +2 -1
- package/lib/browser/components/nav-places.js +3 -2
- package/lib/browser/components/relay-services.d.ts +1 -1
- package/lib/browser/components/relay-services.js +9 -89
- package/lib/browser/components/said-text.d.ts +6 -2
- package/lib/browser/components/said-text.js +8 -2
- package/lib/browser/components/serve-restart.d.ts +11 -2
- package/lib/browser/components/serve-restart.js +64 -3
- package/lib/browser/components/session-view.js +3 -2
- package/lib/browser/components/settings-more.js +7 -4
- package/lib/browser/components/workbench-tabs.d.ts +4 -2
- package/lib/browser/components/workbench-tabs.js +5 -3
- package/lib/browser/extension/extension-view.d.ts +9 -1
- package/lib/browser/extension/extension-view.js +12 -0
- package/lib/browser/extension/icons.js +9 -0
- package/lib/browser/extension/web-api-contributions.d.ts +19 -14
- package/lib/browser/extension/web-api-editors.d.ts +33 -0
- package/lib/browser/extension/web-api-editors.js +3 -0
- package/lib/browser/extension/web-api-menus.d.ts +41 -0
- package/lib/browser/extension/web-api-menus.js +3 -0
- package/lib/browser/extension/web-api-partners.d.ts +6 -0
- package/lib/browser/extension/web-extension-api.d.ts +9 -26
- package/lib/browser/extension/web-extension-context.js +5 -9
- package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
- package/lib/browser/extension/web-extension-protocol.js +1 -0
- package/lib/browser/extension/web-extension-run.d.ts +5 -2
- package/lib/browser/extension/web-extension-run.js +15 -0
- package/lib/browser/extension/web-home.js +8 -0
- package/lib/browser/extension/web-session-notices.js +8 -0
- package/lib/browser/i18n/locales.d.ts +12 -1
- package/lib/browser/i18n/messages-ja.js +13 -2
- package/lib/browser/i18n/messages-zh-tw.js +13 -2
- package/lib/browser/i18n/messages.d.ts +11 -0
- package/lib/browser/i18n/messages.js +27 -5
- package/lib/browser/notices/chime.d.ts +17 -0
- package/lib/browser/notices/chime.js +71 -0
- package/lib/browser/notices/session-notices.d.ts +8 -0
- package/lib/browser/notices/session-notices.js +23 -2
- package/lib/browser/share/shared-page.js +2 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +5 -3
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation-column.js +2 -2
- package/lib/browser/style/device.js +2 -2
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +9 -1
- package/lib/browser/style/shared.d.ts +1 -1
- package/lib/browser/style/shared.js +1 -0
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +7 -4
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style/tasks.js +1 -1
- package/lib/browser/util/image-swipe.d.ts +14 -3
- package/lib/browser/util/image-swipe.js +26 -3
- package/lib/browser/util/process.d.ts +5 -0
- package/lib/browser/util/process.js +22 -1
- package/lib/browser/workbench-protocol.d.ts +5 -0
- package/lib/browser/workbench.d.ts +1 -0
- package/lib/browser/workbench.js +20 -0
- package/package.json +7 -7
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.AssistantThread =
|
|
36
|
+
exports.AssistantThread = void 0;
|
|
37
37
|
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
38
38
|
const lucide_react_1 = require("lucide-react");
|
|
39
39
|
const React = __importStar(require("react"));
|
|
@@ -81,8 +81,61 @@ function DoubleUserMessage({ message, blocks }) {
|
|
|
81
81
|
React.createElement(message_footer_1.UserFooter, { message: message, text: copied }),
|
|
82
82
|
menu));
|
|
83
83
|
}
|
|
84
|
-
/**
|
|
85
|
-
function
|
|
84
|
+
/** A row of the double's conversation: a turn of it, or what the user (or a task reporting back) said. */
|
|
85
|
+
function DoubleRowView({ item, tools, mood, status, latest, started, onTask, t }) {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
if (item.kind === 'turn') {
|
|
88
|
+
const results = message_1.MessageUtil.results(item.messages);
|
|
89
|
+
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
90
|
+
const stopReason = message_1.MessageUtil.stopReason(item.last);
|
|
91
|
+
return (React.createElement(DoubleTurn, { item: item, latest: latest },
|
|
92
|
+
React.createElement(message_steps_1.Process, { steps: item.steps, active: item.active, results: results, tools: tools, leading: React.createElement(message_list_1.TurnAvatar, { mood: mood }), status: status }),
|
|
93
|
+
React.createElement(task_views_1.TaskCards, { tasks: started }),
|
|
94
|
+
item.reply.map((text, index) => (React.createElement(markdown_1.Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
|
|
95
|
+
!item.active && stopReason === 'error' && errorMessage && React.createElement(callout_1.Callout, { level: "error" }, errorMessage)));
|
|
96
|
+
}
|
|
97
|
+
const { role } = item.message;
|
|
98
|
+
if (role === 'custom') {
|
|
99
|
+
return React.createElement(extension_view_1.CustomMessage, { message: item.message });
|
|
100
|
+
}
|
|
101
|
+
if (role !== 'user') {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const blocks = message_1.MessageUtil.blocks(item.message);
|
|
105
|
+
const text = message_1.MessageUtil.text(blocks).trim();
|
|
106
|
+
const note = assistant_task_util_1.AssistantTaskUtil.noteOf(text);
|
|
107
|
+
if (note) {
|
|
108
|
+
// A note of a new id is for the double only: the user sees the task under its id in the lists.
|
|
109
|
+
const line = assistant_task_util_1.AssistantTaskUtil.noteLine(note, t);
|
|
110
|
+
const status = note.status;
|
|
111
|
+
return line ? (React.createElement("button", { type: "button", className: "ta-task-update", onClick: () => onTask(note.id) },
|
|
112
|
+
React.createElement("span", { className: `ta-status ta-status-${(_b = TASK_DOTS[status]) !== null && _b !== void 0 ? _b : 'done'}` }),
|
|
113
|
+
React.createElement("span", { className: "ta-task-update-text" }, line),
|
|
114
|
+
React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 13, className: "ta-task-update-chevron" }))) : null;
|
|
115
|
+
}
|
|
116
|
+
if (ta_protocol_1.TaMessageSource.isNotice(text)) {
|
|
117
|
+
return React.createElement(message_user_1.NoticeMessage, { message: item.message });
|
|
118
|
+
}
|
|
119
|
+
return React.createElement(DoubleUserMessage, { message: item.message, blocks: blocks });
|
|
120
|
+
}
|
|
121
|
+
function sameTasks(a, b) {
|
|
122
|
+
return a.length === b.length && a.every((task, index) => task === b[index]);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A row draws again only when one of its messages changed (the store replaces only those), the tasks it handed out
|
|
126
|
+
* did, or, while the double is at it, a tool run did; not as the page around it draws, nor as the user types.
|
|
127
|
+
*/
|
|
128
|
+
const DoubleRow = React.memo(DoubleRowView, (previous, next) => previous.mood === next.mood &&
|
|
129
|
+
previous.status === next.status &&
|
|
130
|
+
previous.latest === next.latest &&
|
|
131
|
+
previous.t === next.t &&
|
|
132
|
+
previous.onTask === next.onTask &&
|
|
133
|
+
sameTasks(previous.started, next.started) &&
|
|
134
|
+
process_1.ProcessUtil.same(previous.item, next.item) &&
|
|
135
|
+
(next.item.kind === 'message' || !next.item.active || previous.tools === next.tools));
|
|
136
|
+
const NO_TASKS = [];
|
|
137
|
+
/** The double's conversation, as the home of the double shows it: drawn as any conversation is (MessageList), a row at a time. */
|
|
138
|
+
exports.AssistantThread = React.memo(function AssistantThread({ state, reply, tasks, origin, rows, onTask, t }) {
|
|
86
139
|
const renderers = React.useContext(extension_view_1.MessageRenderers);
|
|
87
140
|
const items = React.useMemo(() => process_1.ProcessUtil.items(state.messages, state.working, state.start, renderers, state.head), [state.messages, state.working, state.start, renderers, state.head]);
|
|
88
141
|
const starts = React.useMemo(() => process_1.ProcessUtil.starts(items), [items]);
|
|
@@ -90,6 +143,7 @@ function AssistantThread({ state, reply, tasks, origin, onTask, t }) {
|
|
|
90
143
|
// A turn's cards know what the user said after it: a choice they asked for is made (message-list.tsx).
|
|
91
144
|
const answers = React.useMemo(() => process_1.ProcessUtil.answers(items, message => (0, message_user_1.userWords)(message_1.MessageUtil.blocks(message)).copied), [items]);
|
|
92
145
|
const own = React.useMemo(() => tasks.filter(task => task.origin && task.origin === origin), [tasks, origin]);
|
|
146
|
+
const shown = (0, message_list_1.useThreadRows)(items, rows);
|
|
93
147
|
let lastTurn = items.length - 1;
|
|
94
148
|
while (lastTurn >= 0 && items[lastTurn].kind !== 'turn') {
|
|
95
149
|
lastTurn--;
|
|
@@ -100,49 +154,19 @@ function AssistantThread({ state, reply, tasks, origin, onTask, t }) {
|
|
|
100
154
|
const onHead = status && (0, message_list_1.quiet)(last);
|
|
101
155
|
// The cards of the tasks the last turn handed out come after its steps.
|
|
102
156
|
const inSteps = (0, message_list_1.endsInSteps)(last) && !web_tasks_1.WebTaskUtil.startedIn(own, origin, starts[items.length - 1], Number.POSITIVE_INFINITY).length;
|
|
103
|
-
const row = (item, index) => {
|
|
104
|
-
var _a, _b, _c;
|
|
105
|
-
if (item.kind === 'turn') {
|
|
106
|
-
const results = message_1.MessageUtil.results(item.messages);
|
|
107
|
-
const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
|
|
108
|
-
const stopReason = message_1.MessageUtil.stopReason(item.last);
|
|
109
|
-
const mood = process_1.ProcessUtil.mood(item, index === lastTurn, waiting);
|
|
110
|
-
const started = web_tasks_1.WebTaskUtil.startedIn(own, origin, starts[index], (_b = starts[index + 1]) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY);
|
|
111
|
-
return (React.createElement(code_renderers_1.CodeAnswer.Provider, { key: item.key, value: answers[index] },
|
|
112
|
-
React.createElement(DoubleTurn, { item: item, latest: index === lastTurn },
|
|
113
|
-
React.createElement(message_steps_1.Process, { steps: item.steps, active: item.active, results: results, tools: state.tools, leading: React.createElement(message_list_1.TurnAvatar, { mood: mood }), status: onHead && item === last ? status : undefined }),
|
|
114
|
-
React.createElement(task_views_1.TaskCards, { tasks: started }),
|
|
115
|
-
item.reply.map((text, index) => (React.createElement(markdown_1.Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
|
|
116
|
-
!item.active && stopReason === 'error' && errorMessage && React.createElement(callout_1.Callout, { level: "error" }, errorMessage))));
|
|
117
|
-
}
|
|
118
|
-
const { role } = item.message;
|
|
119
|
-
if (role === 'custom') {
|
|
120
|
-
return React.createElement(extension_view_1.CustomMessage, { key: item.key, message: item.message });
|
|
121
|
-
}
|
|
122
|
-
if (role !== 'user') {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
const blocks = message_1.MessageUtil.blocks(item.message);
|
|
126
|
-
const text = message_1.MessageUtil.text(blocks).trim();
|
|
127
|
-
const note = assistant_task_util_1.AssistantTaskUtil.noteOf(text);
|
|
128
|
-
if (note) {
|
|
129
|
-
// A note of a new id is for the double only: the user sees the task under its id in the lists.
|
|
130
|
-
const line = assistant_task_util_1.AssistantTaskUtil.noteLine(note, t);
|
|
131
|
-
const status = note.status;
|
|
132
|
-
return line ? (React.createElement("button", { key: item.key, type: "button", className: "ta-task-update", onClick: () => onTask(note.id) },
|
|
133
|
-
React.createElement("span", { className: `ta-status ta-status-${(_c = TASK_DOTS[status]) !== null && _c !== void 0 ? _c : 'done'}` }),
|
|
134
|
-
React.createElement("span", { className: "ta-task-update-text" }, line),
|
|
135
|
-
React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 13, className: "ta-task-update-chevron" }))) : null;
|
|
136
|
-
}
|
|
137
|
-
if (ta_protocol_1.TaMessageSource.isNotice(text)) {
|
|
138
|
-
return React.createElement(message_user_1.NoticeMessage, { key: item.key, message: item.message });
|
|
139
|
-
}
|
|
140
|
-
return React.createElement(DoubleUserMessage, { key: item.key, message: item.message, blocks: blocks });
|
|
141
|
-
};
|
|
142
157
|
return (React.createElement(code_renderers_1.CodeReply.Provider, { value: reply },
|
|
143
|
-
items.map((item, index) =>
|
|
144
|
-
|
|
145
|
-
|
|
158
|
+
items.map((item, index) => {
|
|
159
|
+
var _a;
|
|
160
|
+
if (index < shown.from) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
const turn = item.kind === 'turn';
|
|
164
|
+
const started = turn ? web_tasks_1.WebTaskUtil.startedIn(own, origin, starts[index], (_a = starts[index + 1]) !== null && _a !== void 0 ? _a : Number.POSITIVE_INFINITY) : NO_TASKS;
|
|
165
|
+
return (React.createElement("div", { key: item.key, "data-row": item.key, className: shown.className(index) },
|
|
166
|
+
breaks[index] !== undefined && React.createElement(message_footer_1.TimeBreak, { timestamp: breaks[index] }),
|
|
167
|
+
React.createElement(code_renderers_1.CodeAnswer.Provider, { value: answers[index] },
|
|
168
|
+
React.createElement(DoubleRow, { item: item, tools: state.tools, mood: turn ? process_1.ProcessUtil.mood(item, index === lastTurn, waiting) : 'idle', status: onHead && item === last ? status : undefined, latest: index === lastTurn, started: started, onTask: onTask, t: t }))));
|
|
169
|
+
}),
|
|
146
170
|
status && !onHead && React.createElement("div", { className: `ta-run-line ${inSteps ? 'ta-run-steps' : ''}` }, status)));
|
|
147
|
-
}
|
|
171
|
+
});
|
|
148
172
|
//# sourceMappingURL=assistant-thread.js.map
|
|
@@ -212,7 +212,13 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
212
212
|
// What the user said; a task that reports back stays where it comes in.
|
|
213
213
|
const asked = (0, earlier_messages_1.useAsked)(state, saidByUser);
|
|
214
214
|
const scroller = (0, conversation_scroll_hooks_1.useConversationScroll)(asked);
|
|
215
|
-
|
|
215
|
+
// A long conversation draws its latest rows, more as the view nears them, as any conversation does (session-view.tsx).
|
|
216
|
+
const rows = (0, earlier_messages_1.useRowWindow)();
|
|
217
|
+
(0, earlier_messages_1.useEarlierMessages)(store, state, scroller, rows);
|
|
218
|
+
// The same function as the page draws again each second (its mood): the rows of the thread do not draw for it.
|
|
219
|
+
const taskOpened = React.useRef(onTask);
|
|
220
|
+
taskOpened.current = onTask;
|
|
221
|
+
const openTask = React.useCallback((id) => taskOpened.current(id), []);
|
|
216
222
|
const say = (message) => {
|
|
217
223
|
hush();
|
|
218
224
|
return assistant.say(message);
|
|
@@ -337,7 +343,7 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
337
343
|
React.createElement(hero_cards_1.HeroSteps, { steps: STEPS }),
|
|
338
344
|
React.createElement(hero_cards_1.HeroCards, { suggestions: SUGGESTIONS, onPick: send }))) : (React.createElement(message_footer_1.MessageActions.Provider, { value: messageActions },
|
|
339
345
|
React.createElement(message_images_1.MessageImages.Provider, { value: images },
|
|
340
|
-
React.createElement(assistant_thread_1.AssistantThread, { state: state, reply: answerCard, tasks: allTasks, origin: assistant.sessionFile, onTask:
|
|
346
|
+
React.createElement(assistant_thread_1.AssistantThread, { state: state, reply: answerCard, tasks: allTasks, origin: assistant.sessionFile, rows: rows, onTask: openTask, t: t })))))),
|
|
341
347
|
React.createElement("div", { className: "ta-composer-area" },
|
|
342
348
|
React.createElement("div", { className: "ta-chat-col" },
|
|
343
349
|
asks.map(ask => (React.createElement("div", { key: ask.id, className: "ta-attention" },
|
|
@@ -25,7 +25,8 @@ export interface AccountEntry {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* The entries of the account and of the settings, in groups: the settings, the packages and the keys; the model
|
|
28
|
-
* accounts, the default directory and the phone; the theme and the language;
|
|
28
|
+
* accounts, the default directory and the phone; the theme and the language; the pages of extensions that are the
|
|
29
|
+
* user's own (WebView.group `me`: their feedback), about, and signing out.
|
|
29
30
|
*/
|
|
30
31
|
export declare function useAccountEntries(onSettings: (section?: SettingsSection) => void, onDialog: (dialog: AccountDialog) => void): AccountEntry[][];
|
|
31
32
|
/** What the entries of the account open over the page. */
|
|
@@ -44,6 +44,7 @@ const React = __importStar(require("react"));
|
|
|
44
44
|
const account_side_1 = require("../account/account-side");
|
|
45
45
|
const device_account_1 = require("../account/device-account");
|
|
46
46
|
const device_1 = require("../device/device");
|
|
47
|
+
const web_extension_protocol_1 = require("../extension/web-extension-protocol");
|
|
47
48
|
const hooks_1 = require("../hooks");
|
|
48
49
|
const hosts_1 = require("../hosts");
|
|
49
50
|
const use_t_1 = require("../i18n/use-t");
|
|
@@ -56,6 +57,7 @@ const face_1 = require("./face");
|
|
|
56
57
|
const icon_1 = require("./icon");
|
|
57
58
|
const profile_view_1 = require("./profile-view");
|
|
58
59
|
const relay_view_1 = require("./relay-view");
|
|
60
|
+
const secret_peek_1 = require("./secret-peek");
|
|
59
61
|
const serve_restart_1 = require("./serve-restart");
|
|
60
62
|
const settings_controls_1 = require("./settings-controls");
|
|
61
63
|
const working_directory_1 = require("./working-directory");
|
|
@@ -70,7 +72,8 @@ const LANGUAGES = [
|
|
|
70
72
|
];
|
|
71
73
|
/**
|
|
72
74
|
* The entries of the account and of the settings, in groups: the settings, the packages and the keys; the model
|
|
73
|
-
* accounts, the default directory and the phone; the theme and the language;
|
|
75
|
+
* accounts, the default directory and the phone; the theme and the language; the pages of extensions that are the
|
|
76
|
+
* user's own (WebView.group `me`: their feedback), about, and signing out.
|
|
74
77
|
*/
|
|
75
78
|
function useAccountEntries(onSettings, onDialog) {
|
|
76
79
|
const t = (0, use_t_1.useT)();
|
|
@@ -81,11 +84,15 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
81
84
|
// A finger has no keys to learn; a phone is not the computer that pairs phones.
|
|
82
85
|
const { touch, handheld } = (0, device_1.useDevice)();
|
|
83
86
|
const restartTa = (0, serve_restart_1.useRestartTa)();
|
|
87
|
+
// The vault, while its package is on: the one place for the sign-ins, keys and personal details of the account.
|
|
88
|
+
const vault = (0, secret_peek_1.useSecretPeek)().manage;
|
|
84
89
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
85
90
|
const side = (0, account_side_1.useAccountSide)();
|
|
86
91
|
const { info } = (0, account_side_1.useAccountInfo)(side, 15000);
|
|
87
92
|
const signedIn = Boolean(info === null || info === void 0 ? void 0 : info.account);
|
|
88
93
|
const app = workbench_util_1.WorkbenchUtil.isApp();
|
|
94
|
+
const [{ views }, extensions] = (0, hooks_1.useWebExtensions)();
|
|
95
|
+
const own = views.filter(view => view.group === 'me' && view.location === 'page');
|
|
89
96
|
// Signed in, out of the account (its computers go, those connected by a code stay); else out of the computer in use.
|
|
90
97
|
const signOut = async () => {
|
|
91
98
|
if (!signedIn || !side) {
|
|
@@ -125,6 +132,7 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
125
132
|
detail: inUse && (hosts_1.HostUtil.label(inUse) || t('ta.hosts.thisServer')),
|
|
126
133
|
}),
|
|
127
134
|
entry('accounts', t('ta.manage.accounts'), lucide_react_1.KeyRound, () => onDialog('accounts')),
|
|
135
|
+
...(vault ? [entry('vault', t('ta.manage.vault'), lucide_react_1.Vault, vault)] : []),
|
|
128
136
|
entry('directory', t('ta.manage.workingDirectory'), lucide_react_1.FolderOpen, () => onDialog('directory')),
|
|
129
137
|
...(workbench_util_1.WorkbenchUtil.isApp() || handheld ? [] : [entry('relay', t('ta.manage.relay'), lucide_react_1.Smartphone, () => onDialog('relay'))]),
|
|
130
138
|
],
|
|
@@ -153,6 +161,7 @@ function useAccountEntries(onSettings, onDialog) {
|
|
|
153
161
|
entry('restart', restartTa.update ? t('ta.update.restartTo', { version: serve_restart_1.ServeRestartUtil.label(restartTa.update) }) : t('ta.restart'), lucide_react_1.RotateCw, () => void restartTa.restart()),
|
|
154
162
|
]
|
|
155
163
|
: []),
|
|
164
|
+
...own.map(view => { var _a; return entry(`page:${view.id}`, web_extension_protocol_1.WebLabelUtil.text(view.title), ((_a = view.icon) !== null && _a !== void 0 ? _a : lucide_react_1.Info), () => void extensions.showView(view.id)); }),
|
|
156
165
|
entry('about', t('ta.manage.about'), lucide_react_1.Info, () => onSettings('about')),
|
|
157
166
|
// As WeChat's: the account in use kept, with its computers, to come back to in one tap (docs/design/ta-me.md 4).
|
|
158
167
|
...(app && signedIn ? [entry('switchAccount', t('ta.account.switchSignIn'), lucide_react_1.ArrowLeftRight, () => { var _a; return (_a = device_account_1.DeviceAccount.current()) === null || _a === void 0 ? void 0 : _a.switchAccount(); })] : []),
|
|
@@ -147,11 +147,11 @@ function SidebarView({ view }) {
|
|
|
147
147
|
return (React.createElement("section", { className: "ta-side-view", "aria-label": title, "data-arrived": arrived ? '' : undefined },
|
|
148
148
|
React.createElement("header", { className: "ta-chats-head" }, Head ? (React.createElement("div", { className: "ta-side-view-head" },
|
|
149
149
|
React.createElement(extension_view_1.ExtensionBoundary, { key: view.id, name: title, resetKey: Head },
|
|
150
|
-
React.createElement(
|
|
150
|
+
React.createElement(extension_view_1.ExtensionPart, { component: Head })))) : (React.createElement("span", { className: "ta-chats-title" }, title))),
|
|
151
151
|
React.createElement(connection_bar_1.ConnectionBanner, null),
|
|
152
152
|
React.createElement("div", { className: "ta-side-view-body" },
|
|
153
153
|
React.createElement(extension_view_1.ExtensionBoundary, { key: view.id, name: title, resetKey: View },
|
|
154
|
-
React.createElement(
|
|
154
|
+
React.createElement(extension_view_1.ExtensionPart, { component: View })))));
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
157
|
* A page of a web extension in the main area: its head (`leading` first: the menu, or back), then the page. While
|
|
@@ -167,11 +167,11 @@ function PageView({ view, leading }) {
|
|
|
167
167
|
pushed ? React.createElement(icon_1.IconButton, { icon: lucide_react_1.ChevronLeft, label: t('ta.back'), onClick: () => pushed.close() }) : leading,
|
|
168
168
|
view.head ? (React.createElement("div", { className: "ta-main-head-view" },
|
|
169
169
|
React.createElement(extension_view_1.ExtensionBoundary, { key: view.id, name: title, resetKey: view.head },
|
|
170
|
-
React.createElement(view.head
|
|
170
|
+
React.createElement(extension_view_1.ExtensionPart, { component: view.head })))) : (React.createElement("div", { className: "ta-main-title" },
|
|
171
171
|
React.createElement("span", null, title))),
|
|
172
172
|
React.createElement(workbench_toggle_1.WorkbenchToggle, null)),
|
|
173
173
|
React.createElement("div", { className: "ta-page-body" },
|
|
174
174
|
React.createElement(extension_view_1.ExtensionBoundary, { key: view.id, name: title, resetKey: View },
|
|
175
|
-
React.createElement(
|
|
175
|
+
React.createElement(extension_view_1.ExtensionPart, { component: View })))));
|
|
176
176
|
}
|
|
177
177
|
//# sourceMappingURL=app-nav.js.map
|
|
@@ -71,9 +71,24 @@ var ChatAskUtil;
|
|
|
71
71
|
function entryOf(sessions, saved, session) {
|
|
72
72
|
const { sessionId, sessionFile } = session;
|
|
73
73
|
const open = sessions.find(each => each.sessionId === sessionId || (!!sessionFile && each.sessionFile === sessionFile));
|
|
74
|
-
return open !== null && open !== void 0 ? open : (sessionFile ? saved.
|
|
74
|
+
return open !== null && open !== void 0 ? open : (sessionFile ? byFile(saved).get(sessionFile) : undefined);
|
|
75
75
|
}
|
|
76
76
|
ChatAskUtil.entryOf = entryOf;
|
|
77
|
+
/** The saved ones by their file, made once for a list: asked of every task as the lists draw, of hundreds. */
|
|
78
|
+
const indexed = new WeakMap();
|
|
79
|
+
function byFile(saved) {
|
|
80
|
+
let index = indexed.get(saved);
|
|
81
|
+
if (!index) {
|
|
82
|
+
index = new Map();
|
|
83
|
+
for (const each of saved) {
|
|
84
|
+
if (!index.has(each.sessionFile)) {
|
|
85
|
+
index.set(each.sessionFile, each);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
indexed.set(saved, index);
|
|
89
|
+
}
|
|
90
|
+
return index;
|
|
91
|
+
}
|
|
77
92
|
/** Whether it waits for the user: it asks, or a dialog of it waits. */
|
|
78
93
|
function waits(entry, letGo) {
|
|
79
94
|
return !!entry.waiting || !!asking(entry, letGo);
|
|
@@ -39,6 +39,8 @@ export declare function ChatHomeItem({ row, time, home, selected, pinned, onPin,
|
|
|
39
39
|
pinned: boolean;
|
|
40
40
|
onPin(pinned: boolean): void;
|
|
41
41
|
}): React.JSX.Element;
|
|
42
|
+
/** What a row of a task does to the double's home: marks it seen, deletes it. */
|
|
43
|
+
export type ChatTaskHome = Pick<ChatHome, 'look' | 'remove'>;
|
|
42
44
|
/**
|
|
43
45
|
* A task of the double that is no conversation (a team), or one that waits for the user: who does it, what it is at,
|
|
44
46
|
* when; a blue ? while it waits, an amber dot once it ended unseen. It opens in the main area, its conversation or its
|
|
@@ -46,7 +48,8 @@ export declare function ChatHomeItem({ row, time, home, selected, pinned, onPin,
|
|
|
46
48
|
*/
|
|
47
49
|
export declare const ChatTaskItem: React.MemoExoticComponent<({ task, home, unseen, time, onPicked, }: {
|
|
48
50
|
task: WebTaskEntry;
|
|
49
|
-
home:
|
|
51
|
+
/** What it does to the double's home: one that stays the same (ChatList), for the row not to draw again for nothing. */
|
|
52
|
+
home: ChatTaskHome;
|
|
50
53
|
unseen: boolean;
|
|
51
54
|
time: string;
|
|
52
55
|
/** As it opens in the main area: a drawer closes, a phone slides it in (ChatListProps.onPicked). */
|
|
@@ -56,8 +59,10 @@ export declare const ChatTaskItem: React.MemoExoticComponent<({ task, home, unse
|
|
|
56
59
|
* The top of the double's list: its card (`double`, unless a search leaves it out), then what waits for the user to
|
|
57
60
|
* decide, above the conversations. The rows extensions add are rows of the list, pinned at first (ChatListUtil.offerPins).
|
|
58
61
|
*/
|
|
59
|
-
export declare function ChatHomeTop({ home, double, waiting, counts, unseen, now, onPicked, }: {
|
|
62
|
+
export declare function ChatHomeTop({ home, taskHome, double, waiting, counts, unseen, now, onPicked, }: {
|
|
60
63
|
home: ChatHome;
|
|
64
|
+
/** The same, for the rows of what waits for the user (ChatTaskItem). */
|
|
65
|
+
taskHome: ChatTaskHome;
|
|
61
66
|
double: boolean;
|
|
62
67
|
waiting: readonly WebTaskEntry[];
|
|
63
68
|
counts: ChatHomeCounts;
|
|
@@ -160,7 +160,7 @@ exports.ChatTaskItem = React.memo(function ChatTaskItem({ task, home, unseen, ti
|
|
|
160
160
|
* The top of the double's list: its card (`double`, unless a search leaves it out), then what waits for the user to
|
|
161
161
|
* decide, above the conversations. The rows extensions add are rows of the list, pinned at first (ChatListUtil.offerPins).
|
|
162
162
|
*/
|
|
163
|
-
function ChatHomeTop({ home, double, waiting, counts, unseen, now, onPicked, }) {
|
|
163
|
+
function ChatHomeTop({ home, taskHome, double, waiting, counts, unseen, now, onPicked, }) {
|
|
164
164
|
const t = (0, use_t_1.useT)();
|
|
165
165
|
return (React.createElement(React.Fragment, null,
|
|
166
166
|
double && (React.createElement("section", { className: "ta-chat-section ta-chat-home" },
|
|
@@ -168,6 +168,6 @@ function ChatHomeTop({ home, double, waiting, counts, unseen, now, onPicked, })
|
|
|
168
168
|
React.createElement(ChatDoubleItem, { home: home, counts: counts, unseen: unseen, now: now })))),
|
|
169
169
|
waiting.length > 0 && (React.createElement("section", { className: "ta-chat-section ta-chat-decide" },
|
|
170
170
|
React.createElement("div", { className: "ta-chat-section-title" }, t('ta.home.decide')),
|
|
171
|
-
React.createElement("ul", { className: "ta-side-list" }, waiting.map(task => (React.createElement(exports.ChatTaskItem, { key: task.key, task: task, home:
|
|
171
|
+
React.createElement("ul", { className: "ta-side-list" }, waiting.map(task => (React.createElement(exports.ChatTaskItem, { key: task.key, task: task, home: taskHome, unseen: false, time: chat_list_util_1.ChatListUtil.clock(task.startedAt, now), onPicked: onPicked }))))))));
|
|
172
172
|
}
|
|
173
173
|
//# sourceMappingURL=chat-home.js.map
|
|
@@ -11,7 +11,12 @@ export type ChatFolderIcon = FoundChatIcon & {
|
|
|
11
11
|
};
|
|
12
12
|
/** The icons web extensions give conversations of theirs (WebExtensionAPI.registerChatIcon). */
|
|
13
13
|
export declare namespace ChatIconUtil {
|
|
14
|
-
/**
|
|
14
|
+
/** An extension said its icons changed, or the language did: they are asked again. */
|
|
15
|
+
function changed(): void;
|
|
16
|
+
/**
|
|
17
|
+
* The icon of the first extension that gives one, with its tint; an extension that throws gives none. Asked once
|
|
18
|
+
* for a conversation (what WebChat has of it) until the icons change: the lists ask it of hundreds as they draw.
|
|
19
|
+
*/
|
|
15
20
|
function find(entries: readonly WebChatIconEntry[], chat: WebChat): FoundChatIcon | undefined;
|
|
16
21
|
/**
|
|
17
22
|
* Since when a conversation an extension archives sooner (WebChatIcon.archiveMinutes, archiveDays) stays listed,
|
|
@@ -39,13 +39,44 @@ exports.useChatIcon = useChatIcon;
|
|
|
39
39
|
exports.ChatIconTile = ChatIconTile;
|
|
40
40
|
const React = __importStar(require("react"));
|
|
41
41
|
const extension_view_1 = require("../extension/extension-view");
|
|
42
|
+
const use_t_1 = require("../i18n/use-t");
|
|
42
43
|
const workbench_util_1 = require("../workbench-util");
|
|
43
44
|
const launcher_search_util_1 = require("./launcher-search-util");
|
|
44
45
|
/** The icons web extensions give conversations of theirs (WebExtensionAPI.registerChatIcon). */
|
|
45
46
|
var ChatIconUtil;
|
|
46
47
|
(function (ChatIconUtil) {
|
|
47
|
-
/**
|
|
48
|
+
/** Counts what extensions said changed of their icons (ChatIconsProvider): what `find` remembered from before is asked again. */
|
|
49
|
+
let generation = 0;
|
|
50
|
+
const remembered = new WeakMap();
|
|
51
|
+
/** An extension said its icons changed, or the language did: they are asked again. */
|
|
52
|
+
function changed() {
|
|
53
|
+
generation++;
|
|
54
|
+
}
|
|
55
|
+
ChatIconUtil.changed = changed;
|
|
56
|
+
/**
|
|
57
|
+
* The icon of the first extension that gives one, with its tint; an extension that throws gives none. Asked once
|
|
58
|
+
* for a conversation (what WebChat has of it) until the icons change: the lists ask it of hundreds as they draw.
|
|
59
|
+
*/
|
|
48
60
|
function find(entries, chat) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
if (entries.length === 0) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
let memo = remembered.get(entries);
|
|
66
|
+
if ((memo === null || memo === void 0 ? void 0 : memo.generation) !== generation) {
|
|
67
|
+
memo = { generation, found: new Map() };
|
|
68
|
+
remembered.set(entries, memo);
|
|
69
|
+
}
|
|
70
|
+
const key = `${(_a = chat.group) !== null && _a !== void 0 ? _a : ''}\n${chat.cwd}\n${(_b = chat.sessionFile) !== null && _b !== void 0 ? _b : ''}`;
|
|
71
|
+
if (memo.found.has(key)) {
|
|
72
|
+
return memo.found.get(key);
|
|
73
|
+
}
|
|
74
|
+
const found = ask(entries, { sessionFile: chat.sessionFile, cwd: chat.cwd, ...(chat.group ? { group: chat.group } : {}) });
|
|
75
|
+
memo.found.set(key, found);
|
|
76
|
+
return found;
|
|
77
|
+
}
|
|
78
|
+
ChatIconUtil.find = find;
|
|
79
|
+
function ask(entries, chat) {
|
|
49
80
|
var _a;
|
|
50
81
|
for (const { extension, source } of entries) {
|
|
51
82
|
try {
|
|
@@ -69,7 +100,6 @@ var ChatIconUtil;
|
|
|
69
100
|
}
|
|
70
101
|
return undefined;
|
|
71
102
|
}
|
|
72
|
-
ChatIconUtil.find = find;
|
|
73
103
|
/**
|
|
74
104
|
* Since when a conversation an extension archives sooner (WebChatIcon.archiveMinutes, archiveDays) stays listed,
|
|
75
105
|
* for ChatListUtil.entries; none without extensions that give icons.
|
|
@@ -107,8 +137,18 @@ var ChatIconUtil;
|
|
|
107
137
|
/** Gives the lists the icons of the extensions, and draws their rows again when an extension says they changed. */
|
|
108
138
|
function ChatIconsProvider({ entries, children }) {
|
|
109
139
|
const [version, setVersion] = React.useState(0);
|
|
140
|
+
// What an icon says (the name of its folder) may be in the language of the page.
|
|
141
|
+
const language = (0, use_t_1.useLanguage)();
|
|
142
|
+
const languageShown = React.useRef(language);
|
|
143
|
+
if (languageShown.current !== language) {
|
|
144
|
+
languageShown.current = language;
|
|
145
|
+
ChatIconUtil.changed();
|
|
146
|
+
}
|
|
110
147
|
React.useEffect(() => {
|
|
111
|
-
const changed = () =>
|
|
148
|
+
const changed = () => {
|
|
149
|
+
ChatIconUtil.changed();
|
|
150
|
+
setVersion(count => count + 1);
|
|
151
|
+
};
|
|
112
152
|
const stops = entries.map(({ source }) => {
|
|
113
153
|
var _a;
|
|
114
154
|
try {
|
|
@@ -124,7 +164,8 @@ function ChatIconsProvider({ entries, children }) {
|
|
|
124
164
|
}
|
|
125
165
|
};
|
|
126
166
|
}, [entries]);
|
|
127
|
-
|
|
167
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: a new language is a new value, what the icons say read again
|
|
168
|
+
const value = React.useMemo(() => ({ entries: [...entries], version }), [entries, version, language]);
|
|
128
169
|
return React.createElement(extension_view_1.ChatIcons.Provider, { value: value }, children);
|
|
129
170
|
}
|
|
130
171
|
/** The icon of a conversation, when an extension gives it one. */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { WebChat, WebHomeEntry } from '../extension/web-extension-api';
|
|
3
|
+
import type { ChatTaskHome } from './chat-home';
|
|
4
|
+
import { type ChatHome } from './chat-home-util';
|
|
3
5
|
import type { ChatFolderIcon } from './chat-icon';
|
|
4
6
|
import { type ChatEntry } from './chat-list-util';
|
|
5
7
|
/**
|
|
@@ -30,4 +32,12 @@ export declare function usePageEnd(more: boolean, root: React.RefObject<HTMLElem
|
|
|
30
32
|
page: string): void;
|
|
31
33
|
/** A conversation that comes to the top, is pinned or let go slides to its place in the list and in a folder opened, as the others make room. */
|
|
32
34
|
export declare function useChatListMotion(list: React.RefObject<HTMLElement | null>, folder: React.RefObject<HTMLElement | null>): void;
|
|
35
|
+
/**
|
|
36
|
+
* What the rows of tasks do (ChatTaskItem), the same function and object however often the list draws: a row draws
|
|
37
|
+
* again as its task does, not as the list or the page around it does.
|
|
38
|
+
*/
|
|
39
|
+
export declare function useTaskRows(onPicked: () => void, home: ChatHome | undefined): {
|
|
40
|
+
picked: () => void;
|
|
41
|
+
taskHome: ChatTaskHome;
|
|
42
|
+
};
|
|
33
43
|
//# sourceMappingURL=chat-list-hooks.d.ts.map
|
|
@@ -38,6 +38,7 @@ exports.useReadArchive = useReadArchive;
|
|
|
38
38
|
exports.useMinute = useMinute;
|
|
39
39
|
exports.usePageEnd = usePageEnd;
|
|
40
40
|
exports.useChatListMotion = useChatListMotion;
|
|
41
|
+
exports.useTaskRows = useTaskRows;
|
|
41
42
|
const react_1 = require("@celljs/react");
|
|
42
43
|
const React = __importStar(require("react"));
|
|
43
44
|
const state_protocol_1 = require("../state/state-protocol");
|
|
@@ -124,4 +125,19 @@ function useChatListMotion(list, folder) {
|
|
|
124
125
|
(0, list_motion_1.useListMotion)(list);
|
|
125
126
|
(0, list_motion_1.useListMotion)(folder);
|
|
126
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* What the rows of tasks do (ChatTaskItem), the same function and object however often the list draws: a row draws
|
|
130
|
+
* again as its task does, not as the list or the page around it does.
|
|
131
|
+
*/
|
|
132
|
+
function useTaskRows(onPicked, home) {
|
|
133
|
+
const latest = React.useRef({ onPicked, home });
|
|
134
|
+
latest.current = { onPicked, home };
|
|
135
|
+
return React.useMemo(() => ({
|
|
136
|
+
picked: () => latest.current.onPicked(),
|
|
137
|
+
taskHome: {
|
|
138
|
+
look: (key, at) => { var _a; return (_a = latest.current.home) === null || _a === void 0 ? void 0 : _a.look(key, at); },
|
|
139
|
+
remove: tasks => { var _a; return (_a = latest.current.home) === null || _a === void 0 ? void 0 : _a.remove(tasks); },
|
|
140
|
+
},
|
|
141
|
+
}), []);
|
|
142
|
+
}
|
|
127
143
|
//# sourceMappingURL=chat-list-hooks.js.map
|
|
@@ -88,6 +88,7 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
|
|
|
88
88
|
const sessionMenus = React.useContext(extension_view_1.SessionMenus);
|
|
89
89
|
const latest = React.useRef({ chat, double, onPicked, t, pinned, onPinned, sessionMenus, onLetGo, onUnseen });
|
|
90
90
|
latest.current = { chat, double, onPicked, t, pinned, onPinned, sessionMenus, onLetGo, onUnseen };
|
|
91
|
+
const { picked, taskHome } = (0, chat_list_hooks_1.useTaskRows)(onPicked, home);
|
|
91
92
|
// The last pinned first, as several may be: a conversation's file, a folder's key.
|
|
92
93
|
const pinKey = React.useCallback((key, pin) => {
|
|
93
94
|
const others = latest.current.pinned.filter(other => other !== key);
|
|
@@ -124,11 +125,8 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
|
|
|
124
125
|
},
|
|
125
126
|
};
|
|
126
127
|
}, [pinKey]);
|
|
127
|
-
// A failure is a notice of the chat.
|
|
128
|
-
const pick = (
|
|
129
|
-
void change;
|
|
130
|
-
onPicked();
|
|
131
|
-
};
|
|
128
|
+
// A failure is a notice of the chat: what it changes goes on without the list.
|
|
129
|
+
const pick = (_change) => onPicked();
|
|
132
130
|
// Worked out again only when the conversations or the search change, not as the minute or the selection does.
|
|
133
131
|
// The bounds of the archive and of the fold move once a day.
|
|
134
132
|
const searching = !!query.trim();
|
|
@@ -308,7 +306,7 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
|
|
|
308
306
|
}
|
|
309
307
|
}, [folderShown, folder]);
|
|
310
308
|
const folderItem = (row, archived) => (React.createElement(chat_list_row_1.ChatFolderItem, { key: row.key, folder: row, time: chat_list_util_1.ChatListUtil.clock(row.updatedAt, now), selected: row.sessions.some(isSelected), unseen: row.sessions.filter(isUnseen), pinned: pinnedKeys.has(row.key), onOpen: () => openFolder(row.key, archived), onPin: pin => pinKey(row.key, pin), actions: actions }));
|
|
311
|
-
const taskItem = (row) => home && (React.createElement(chat_home_1.ChatTaskItem, { key: row.key, task: row.task, home:
|
|
309
|
+
const taskItem = (row) => home && (React.createElement(chat_home_1.ChatTaskItem, { key: row.key, task: row.task, home: taskHome, unseen: taskUnseen(row.task), time: chat_list_util_1.ChatListUtil.clock(row.updatedAt, now), onPicked: picked }));
|
|
312
310
|
const homeItem = (row) => { var _a; return home && (React.createElement(chat_home_1.ChatHomeItem, { key: row.key, row: row, time: row.updatedAt ? chat_list_util_1.ChatListUtil.clock(row.updatedAt, now) : '', home: home, selected: !!row.item.sessionFile && isSelected((_a = byFile.get(row.item.sessionFile)) !== null && _a !== void 0 ? _a : row.item.sessionFile), pinned: pinnedKeys.has(row.key), onPin: pin => pinKey(row.key, pin) })); };
|
|
313
311
|
const rowItem = (row, compact) => chat_list_util_1.ChatListUtil.isFolder(row) ? folderItem(row) : chat_list_util_1.ChatListUtil.isTask(row) ? taskItem(row) : chat_list_util_1.ChatListUtil.isHome(row) ? homeItem(row) : item(row, compact);
|
|
314
312
|
// The conversation shown is found in the list, however it came to be shown: out of a search that hides it, and scrolled to.
|
|
@@ -461,10 +459,10 @@ function ChatList({ sessions, saved, removed: removedFiles, archived: archivedSa
|
|
|
461
459
|
// The double's card and the rows under it, then what waits for the user: above all the rest.
|
|
462
460
|
const homeWaiting = homeTasks ? homeTasks.waiting.filter(task => chat_home_util_1.ChatHomeUtil.matches(query, task.title, task.detail)) : [];
|
|
463
461
|
const doubleEntry = home && double ? listed.find(entry => chat_list_util_1.ChatListUtil.isDouble(entry, double)) : undefined;
|
|
464
|
-
const homeTop = home && (React.createElement(chat_home_1.ChatHomeTop, { home: home, double: chat_home_util_1.ChatHomeUtil.matches(query, home.double.name), waiting: homeWaiting, counts: chat_home_util_1.ChatHomeUtil.counts(home.tasks, task => {
|
|
462
|
+
const homeTop = home && (React.createElement(chat_home_1.ChatHomeTop, { home: home, taskHome: taskHome, double: chat_home_util_1.ChatHomeUtil.matches(query, home.double.name), waiting: homeWaiting, counts: chat_home_util_1.ChatHomeUtil.counts(home.tasks, task => {
|
|
465
463
|
const entry = task.session ? byFile.get(task.session) : undefined;
|
|
466
464
|
return entry ? isUnseen(entry) : !task.session && taskUnseen(task);
|
|
467
|
-
}), unseen: !!doubleEntry && isUnseen(doubleEntry), now: now, onPicked:
|
|
465
|
+
}), unseen: !!doubleEntry && isUnseen(doubleEntry), now: now, onPicked: picked }));
|
|
468
466
|
const nothingFound = shown.length === 0 && taskRows.length === 0 && homeRows.length === 0;
|
|
469
467
|
const listContent = busy ? (busyContent) : (React.createElement(React.Fragment, null,
|
|
470
468
|
homeTop,
|