gcf-board 0.16.4 → 0.16.9
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 +2 -4
- package/dist/server/talks.js +32 -6
- package/dist/web/assets/index-BMO2AlDy.js +66 -0
- package/dist/web/assets/index-i3nTqHUr.css +1 -0
- package/dist/web/index.html +2 -2
- package/node_modules/gcf-session/lib/activity.js +23 -5
- package/node_modules/gcf-session/lib/job.js +2 -1
- package/node_modules/gcf-session/lib/session.js +11 -2
- package/node_modules/gcf-session/package.json +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-Bkuzk0Ea.js +0 -66
- package/dist/web/assets/index-DwanTUVJ.css +0 -1
package/dist/server/app.js
CHANGED
|
@@ -23,7 +23,7 @@ import { isUpload, saveUpload, UPLOAD_MAX } from './upload.js';
|
|
|
23
23
|
import { addProject, listProjects, projectOf, removeProject } from './registry.js';
|
|
24
24
|
import { allThemes } from './themes.js';
|
|
25
25
|
import { adoptRuns, busyCheck, keepProjects, sweepRuns, closeReport, forgetProject, resumeQueue, runsOf, startRun, unqueue, } from './runs.js';
|
|
26
|
-
import { acceptProposal, agentDefaults, agentPresets, chatCard, chatOf,
|
|
26
|
+
import { acceptProposal, agentDefaults, agentPresets, chatCard, chatOf, entryTalk, listTalks, openTalk, pickTalk, prepareTalk, startDesign, startTalk, stopTalk, talkEntry, talkId, talkLive, talkSaid, talkWaits, watchTalks, writeTalk, } from './talks.js';
|
|
27
27
|
import { threadDir, threadOfEntry } from 'gcf-session';
|
|
28
28
|
const send = (res, status, body) => {
|
|
29
29
|
res.writeHead(status, { 'content-type': 'application/json; charset=utf-8' });
|
|
@@ -792,9 +792,7 @@ export function createApp(o) {
|
|
|
792
792
|
throw new HttpError(409, 'the usage limit holds for the account: start after its reset');
|
|
793
793
|
drafting.add(key);
|
|
794
794
|
try {
|
|
795
|
-
const
|
|
796
|
-
await prepareTalk(p, board, id);
|
|
797
|
-
await sendTalk(p, id, { type: 'say', text: say }, board);
|
|
795
|
+
const id = await startDesign(p, board, m[2], startGiven(body), (t, say) => sendTalk(p, t, { type: 'say', text: say }, board));
|
|
798
796
|
broadcast({ type: 'talks', project: p.name });
|
|
799
797
|
send(res, 201, { thread: id });
|
|
800
798
|
}
|
package/dist/server/talks.js
CHANGED
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
// and what became of them (AD-33) are in `proposals.json`.
|
|
8
8
|
import { spawn, spawnSync } from 'node:child_process';
|
|
9
9
|
import { randomBytes } from 'node:crypto';
|
|
10
|
-
import { appendFileSync, existsSync, lstatSync, mkdirSync, readFileSync, statSync, writeFileSync, } from 'node:fs';
|
|
10
|
+
import { appendFileSync, existsSync, lstatSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync, } from 'node:fs';
|
|
11
11
|
import os from 'node:os';
|
|
12
12
|
import path from 'node:path';
|
|
13
13
|
import { fileURLToPath } from 'node:url';
|
|
14
14
|
import { THREAD_ID, createThread, defaultsOf, listThreads, presetsOf, readThread, setThreadAgent, threadAgent, threadDir, threadOf, threadOfEntry, } from 'gcf-session';
|
|
15
15
|
import { runModeOf } from '../shared/board.js';
|
|
16
16
|
import { writeAtomic } from './atomic.js';
|
|
17
|
+
import { briefError } from './cli.js';
|
|
17
18
|
import { alive } from './events.js';
|
|
18
19
|
import { HttpError } from './http-error.js';
|
|
19
20
|
import { IMAGE_EXT } from './chat.js';
|
|
@@ -334,10 +335,17 @@ export function designTalk(p, board, start, given) {
|
|
|
334
335
|
const t = createThread(p.path, { start: { id: start } });
|
|
335
336
|
let file = '';
|
|
336
337
|
if (given.file && name) {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
try {
|
|
339
|
+
const att = path.join(writeDir(p, t), 'att');
|
|
340
|
+
mkdirSync(att, { recursive: true });
|
|
341
|
+
writeFileSync(path.join(att, name), given.file.text);
|
|
342
|
+
file = path.relative(p.path, path.join(att, name)).replaceAll('\\', '/');
|
|
343
|
+
}
|
|
344
|
+
catch (e) {
|
|
345
|
+
// The GDD not kept: no thread stays for it, as for a first message that never went.
|
|
346
|
+
rmSync(dirOf(p, t), { recursive: true, force: true });
|
|
347
|
+
throw e;
|
|
348
|
+
}
|
|
341
349
|
}
|
|
342
350
|
const say = s.say
|
|
343
351
|
.replaceAll('{file}', file)
|
|
@@ -346,6 +354,21 @@ export function designTalk(p, board, start, given) {
|
|
|
346
354
|
.replaceAll('{text}', text);
|
|
347
355
|
return { id: t, say };
|
|
348
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Design start `start` (designTalk), its first message sent by `send`: the thread's id. A send
|
|
359
|
+
* that fails takes the thread away with it, so no empty thread stays in the list.
|
|
360
|
+
*/
|
|
361
|
+
export async function startDesign(p, board, start, given, send) {
|
|
362
|
+
const { id, say } = designTalk(p, board, start, given);
|
|
363
|
+
try {
|
|
364
|
+
await send(id, say);
|
|
365
|
+
}
|
|
366
|
+
catch (e) {
|
|
367
|
+
rmSync(dirOf(p, id), { recursive: true, force: true });
|
|
368
|
+
throw e;
|
|
369
|
+
}
|
|
370
|
+
return id;
|
|
371
|
+
}
|
|
349
372
|
// A GDD's name kept in gcf/source/: the board's file route shows `[\w./-]` names only.
|
|
350
373
|
const GDD_NAME = /^[\w][\w.-]*\.md$/;
|
|
351
374
|
/**
|
|
@@ -495,7 +518,10 @@ export async function acceptProposal(p, t, id, move, item, ids, run, mark) {
|
|
|
495
518
|
});
|
|
496
519
|
const r = await run();
|
|
497
520
|
await setRecord(td, id, {
|
|
498
|
-
|
|
521
|
+
// The card shows the core's refusal, not node's stack around it.
|
|
522
|
+
...(r.ok
|
|
523
|
+
? { state: 'accepted', item }
|
|
524
|
+
: { state: 'refused', error: briefError(r.err || r.out) }),
|
|
499
525
|
at: now(),
|
|
500
526
|
});
|
|
501
527
|
return r;
|