@alashi/cli 0.5.0 → 0.8.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/assets/v1/chat.js
CHANGED
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
* inherits the app's theme tokens.
|
|
11
11
|
*
|
|
12
12
|
* Attributes:
|
|
13
|
-
* app
|
|
14
|
-
* placeholder
|
|
13
|
+
* app app name (default: derived from /app/<name>/ in the URL)
|
|
14
|
+
* placeholder input placeholder text
|
|
15
|
+
* conversations "hidden" for single-conversation mode: no sidebar, no
|
|
16
|
+
* conversations request on connect, no auto-open of the
|
|
17
|
+
* newest conversation. The app drives which transcript is
|
|
18
|
+
* shown via openConversation(id) / adoptSession(...).
|
|
19
|
+
* Any other value (or absence) keeps the default sidebar.
|
|
15
20
|
*
|
|
16
21
|
* Methods:
|
|
17
22
|
* adoptSession(sessionId, title) create a conversation resuming an
|
|
@@ -112,6 +117,9 @@
|
|
|
112
117
|
this._initialized = true;
|
|
113
118
|
this.conversationId = null;
|
|
114
119
|
this._render();
|
|
120
|
+
// Single-conversation mode: the embedding app opens the transcript it
|
|
121
|
+
// wants, so skip both the listing fetch and the auto-open.
|
|
122
|
+
if (this._conversationsHidden) return;
|
|
115
123
|
this._loadConversations()
|
|
116
124
|
.then((conversations) => {
|
|
117
125
|
if (conversations.length > 0) this.openConversation(conversations[0].id);
|
|
@@ -123,6 +131,10 @@
|
|
|
123
131
|
return this.getAttribute('app') ?? decodeURIComponent(window.location.pathname.split('/')[2]);
|
|
124
132
|
}
|
|
125
133
|
|
|
134
|
+
get _conversationsHidden() {
|
|
135
|
+
return this.getAttribute('conversations') === 'hidden';
|
|
136
|
+
}
|
|
137
|
+
|
|
126
138
|
_hostApi(path) {
|
|
127
139
|
return `/api/apps/${encodeURIComponent(this.app)}${path}`;
|
|
128
140
|
}
|
|
@@ -142,12 +154,19 @@
|
|
|
142
154
|
event.preventDefault();
|
|
143
155
|
this._submit();
|
|
144
156
|
});
|
|
157
|
+
const main = el('div', { className: 'panel chat-main' }, [this._log, form, this._status]);
|
|
158
|
+
// In single-conversation mode the sidebar is never appended; `this._list`
|
|
159
|
+
// stays a detached <ul> so the rest of the component keeps working.
|
|
160
|
+
if (this._conversationsHidden) {
|
|
161
|
+
this.append(el('div', { className: 'chat-layout' }, [main]));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
145
164
|
const newChat = el('button', { type: 'button', textContent: '+ New chat' });
|
|
146
165
|
newChat.addEventListener('click', () => this.newChat());
|
|
147
166
|
this.append(
|
|
148
167
|
el('div', { className: 'chat-layout' }, [
|
|
149
168
|
el('div', { className: 'panel conversations-panel' }, [newChat, this._list]),
|
|
150
|
-
|
|
169
|
+
main,
|
|
151
170
|
]),
|
|
152
171
|
);
|
|
153
172
|
}
|
|
@@ -194,6 +213,8 @@
|
|
|
194
213
|
}
|
|
195
214
|
|
|
196
215
|
async _loadConversations() {
|
|
216
|
+
// No sidebar to fill, and no reason to ask the host for a list.
|
|
217
|
+
if (this._conversationsHidden) return [];
|
|
197
218
|
const res = await fetch(this._hostApi('/chat/conversations'));
|
|
198
219
|
const { conversations } = await res.json();
|
|
199
220
|
this._list.replaceChildren(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alashi/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "alashi host: install, manage, and run Claude Code-powered apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"templates"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@alashi/apps-sdk": "^0.
|
|
32
|
+
"@alashi/apps-sdk": "^0.5.0",
|
|
33
33
|
"@hono/node-server": "^2.1.1",
|
|
34
34
|
"commander": "^14.0.0",
|
|
35
35
|
"croner": "^10.0.1",
|
|
36
36
|
"hono": "^4.13.2",
|
|
37
37
|
"semver": "^7.8.5",
|
|
38
38
|
"zod": "^4.4.3",
|
|
39
|
-
"@alashi/provider-claude": "^0.
|
|
39
|
+
"@alashi/provider-claude": "^0.2.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^26.2.0",
|
|
@@ -59,7 +59,9 @@ them — create DB schema lazily (`CREATE TABLE IF NOT EXISTS` on first open).
|
|
|
59
59
|
`:root { --accent: ... }` token overrides only) and `/assets/v1/chat.js` —
|
|
60
60
|
the `<alashi-chat>` web component (conversations, SSE streaming, safe
|
|
61
61
|
markdown incl. images, tool status, cost). Attributes: `app`,
|
|
62
|
-
`placeholder
|
|
62
|
+
`placeholder`, `conversations` (`"hidden"` = single-conversation mode: no
|
|
63
|
+
sidebar, no conversations fetch on connect; the app picks the transcript
|
|
64
|
+
with `openConversation`/`adoptSession`). Methods: `adoptSession(sessionId, title?)`,
|
|
63
65
|
`openConversation(id)`, `newChat()`. Bubbling events: `alashi-chat:turn`
|
|
64
66
|
(`{ok, costUsd, error, conversationId}`), `alashi-chat:conversation`.
|
|
65
67
|
Never vendor or fork system UI; breaking changes ship as `/assets/v2/`.
|