mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-04 00:15:41 -08:00
Sync upstream v3.2.4: slim install refs, a crash-safe installer, Change project restarts the agent (v3.2.4)
AI Assisted
This commit is contained in:
1 parent
50319aa332
commit
f997a82c4d
45 files changed
+7851
-306
No files matched your search
@@ -97,6 +97,19 @@ test("wait's existing outcomes are pinned: submit, images, waiting, cancel, carr
|
||||
|
||||
/* --------------------------------------------- quick question: the channel */
|
||||
|
||||
// `chat` checks the server's /health with a 1.5 s limit, so on a machine loaded by the rest of the
|
||||
// suite a server this test just started, and knows is running, can be reported gone (20). Where the
|
||||
// server must be up, ask again a few times before judging the answer; a real 20 stays 20 when the
|
||||
// server has been stopped (those checks call cli directly).
|
||||
async function chatWhileUp(s) {
|
||||
let r = cli(["chat", "--session", s.sid]);
|
||||
for (let i = 0; i < 4 && r.status === 20; i++) {
|
||||
await sleep(500);
|
||||
r = cli(["chat", "--session", s.sid]);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
test("a chat message and a card send can both be pending, in either order, and wait hands both over at once", async () => {
|
||||
const s = openSession();
|
||||
@@ -160,11 +173,11 @@ test("wait returns within 100 ms of a chat message landing", async () => {
|
||||
test("the chat command answers at once: 0 with entries, 10 with none, 20 when the server is gone, and never takes a card send", async () => {
|
||||
const s = openSession();
|
||||
try {
|
||||
assert.equal(cli(["chat", "--session", s.sid]).status, 10, "a reset alone is nothing to hand over");
|
||||
assert.equal((await chatWhileUp(s)).status, 10, "a reset alone is nothing to hand over");
|
||||
assert.equal((await s.send("/submit", EXPORT_A)).status, 200);
|
||||
assert.equal((await ask(s, "Mid-build question")).status, 200);
|
||||
assert.equal((await (await s.send("/ping", {})).json()).pendingChat, 1, "an uncollected question shows on the heartbeat");
|
||||
const got = cli(["chat", "--session", s.sid]);
|
||||
const got = await chatWhileUp(s);
|
||||
assert.equal(got.status, 0);
|
||||
assert.equal(got.json.chat.length, 1);
|
||||
assert.match(got.json.reply, /Quick question \(\d+\): Mid-build question/);
|
||||
@@ -172,7 +185,7 @@ test("the chat command answers at once: 0 with entries, 10 with none, 20 when th
|
||||
assert.equal(onDisk.consumedAt, undefined, "the card send is still waiting for wait");
|
||||
assert.equal((await (await s.send("/ping", {})).json()).pendingChat, 0);
|
||||
|
||||
const none = cli(["chat", "--session", s.sid]);
|
||||
const none = await chatWhileUp(s);
|
||||
assert.equal(none.status, 10);
|
||||
assert.deepEqual(none.json, {});
|
||||
|
||||
@@ -197,10 +210,10 @@ test("a torn trailing inbox line is skipped, then collected once it is whole", a
|
||||
const line = JSON.stringify({ kind: "message", conversation: 1, text: "torn in two", seq, at: new Date().toISOString() });
|
||||
fs.appendFileSync(file, line.slice(0, 20));
|
||||
assert.equal(readChat(s.session).some((e) => e.seq === seq), false, "a half-written line is not parsed");
|
||||
assert.equal(cli(["chat", "--session", s.sid]).status, 10);
|
||||
assert.equal((await chatWhileUp(s)).status, 10);
|
||||
fs.appendFileSync(file, line.slice(20) + "\n");
|
||||
assert.ok(readChat(s.session).some((e) => e.seq === seq));
|
||||
const got = cli(["chat", "--session", s.sid]);
|
||||
const got = await chatWhileUp(s);
|
||||
assert.equal(got.status, 0);
|
||||
assert.match(got.json.reply, /Quick question \(\d+\): torn in two/);
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user