gcf-board 0.8.1 → 0.8.2
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/server/app.js +6 -5
- package/dist/web/assets/index-D8JZaQgt.js +39 -0
- package/dist/web/assets/{index-D0-5TaR1.css → index-aCBpVSeA.css} +1 -1
- package/dist/web/index.html +2 -2
- package/node_modules/gcf-session/lib/chat.js +9 -4
- package/node_modules/gcf-session/lib/thread.js +7 -3
- package/node_modules/gcf-session/package.json +1 -1
- package/node_modules/gcf-session/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/dist/web/assets/index-C56_xyF9.js +0 -39
package/dist/server/app.js
CHANGED
|
@@ -185,15 +185,16 @@ export function createApp(o) {
|
|
|
185
185
|
};
|
|
186
186
|
/**
|
|
187
187
|
* A message to item `item`'s thread of the project chat (AD-49), when the project has one and
|
|
188
|
-
* the board read knows the item: the thread's id,
|
|
188
|
+
* the board read knows the item: the answer that says so (the thread, the input line's id),
|
|
189
|
+
* else null.
|
|
189
190
|
*/
|
|
190
191
|
const toThread = async (p, item, line) => {
|
|
191
192
|
const board = await boardOf(p).catch(() => null);
|
|
192
193
|
if (!board?.domain.chat || !board.agent?.rules || !idsOf(board).has(item))
|
|
193
194
|
return null;
|
|
194
195
|
const t = openTalk(p, item).id;
|
|
195
|
-
await sendTalk(p, t, line, board);
|
|
196
|
-
return t;
|
|
196
|
+
const sent = await sendTalk(p, t, line, board);
|
|
197
|
+
return { ok: true, talk: t, ...(typeof sent.id === 'string' ? { id: sent.id } : {}) };
|
|
197
198
|
};
|
|
198
199
|
const routes = [
|
|
199
200
|
['GET', /^\/api\/events$/, async (_req, res) => subscribe(res)],
|
|
@@ -320,7 +321,7 @@ export function createApp(o) {
|
|
|
320
321
|
// No harness, so no run: a message goes to the item's thread all the same.
|
|
321
322
|
const t = line.type === 'say' ? await toThread(p, m[2], line) : null;
|
|
322
323
|
if (t)
|
|
323
|
-
return send(res, 202,
|
|
324
|
+
return send(res, 202, t);
|
|
324
325
|
throw e;
|
|
325
326
|
}
|
|
326
327
|
const chat = [harness, 'chat', m[2]];
|
|
@@ -348,7 +349,7 @@ export function createApp(o) {
|
|
|
348
349
|
// An item the board read knows: a stale or mistyped id gets no thread.
|
|
349
350
|
const t = r.code === 3 && line.type === 'say' ? await toThread(p, m[2], line) : null;
|
|
350
351
|
if (t)
|
|
351
|
-
return send(res, 202,
|
|
352
|
+
return send(res, 202, t);
|
|
352
353
|
const why = briefError(r.err || r.out).replace(/^[\w-]+ chat: /, '');
|
|
353
354
|
if (/unknown command 'chat'/.test(why))
|
|
354
355
|
throw new HttpError(400, 'the chat needs gcf-harness-aif-ext 0.11.0 or later');
|