@fractalsynapse/dsh-chapters 0.2.23 → 0.2.25
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/docs/contract.md +3 -0
- package/docs/verify.md +6 -0
- package/lib/client.js +15 -15
- package/lib/client.js.map +1 -1
- package/lib/commands.js +31 -4
- package/lib/commands.js.map +1 -1
- package/lib/index.js +10 -2
- package/lib/index.js.map +1 -1
- package/lib/prompt-runner.d.ts +15 -0
- package/lib/prompt-runner.js +43 -0
- package/lib/prompt-runner.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
package/lib/prompt-runner.js
CHANGED
|
@@ -1,4 +1,47 @@
|
|
|
1
|
+
import { isHumanAuthored, stripReminderSpans } from "./injections.js";
|
|
1
2
|
import { classifyOffer, noSuggestion } from "./prompt-state.js";
|
|
3
|
+
/**
|
|
4
|
+
* #289: was this offer ALREADY SENT? Deterministic, model-free, durable-log-only: the row's offer
|
|
5
|
+
* text, normalized, equal to a HUMAN-authored `user/message` that arrived AFTER the offer was born.
|
|
6
|
+
* The exact case is the whole rule — fuzzy similarity would invent retirements, and a suggestion
|
|
7
|
+
* the human rewrote into their own words is a NEW instruction, not this offer running. Narration is
|
|
8
|
+
* excluded by `isHumanAuthored` (the ONE predicate, #59): the bar's authored autorun message, goal
|
|
9
|
+
* rounds, and host injections are not the human sending it. Reminder spans are stripped before
|
|
10
|
+
* comparing, because the host wraps a real keystroke in them.
|
|
11
|
+
*
|
|
12
|
+
* Who retired what: #285 made a successful Run consume its offer; this covers offers the human sent
|
|
13
|
+
* outside Run (typed, or Run on a version that predated consumption — the maintainer's row 4036,
|
|
14
|
+
* sent twice pre-update and re-rendered forever after it). Read together, an offer that ran cannot
|
|
15
|
+
* be served again from ANY surface, even if the boundary door is dead.
|
|
16
|
+
*/
|
|
17
|
+
export function deliveredOffer(session, offer) {
|
|
18
|
+
if (offer.status !== 'ready' || offer.text === '')
|
|
19
|
+
return false;
|
|
20
|
+
const s = session;
|
|
21
|
+
const events = Array.isArray(s?.events) ? s?.events : (typeof s?.snapshotEvents === 'function' ? s.snapshotEvents() : undefined);
|
|
22
|
+
if (!Array.isArray(events))
|
|
23
|
+
return false;
|
|
24
|
+
const norm = (s) => s.toLowerCase().replace(/\s+/g, ' ').trim();
|
|
25
|
+
const want = norm(offer.text);
|
|
26
|
+
if (want === '')
|
|
27
|
+
return false;
|
|
28
|
+
const bornAt = offer.turnSeq ?? Number.NEGATIVE_INFINITY;
|
|
29
|
+
for (const ev of events) {
|
|
30
|
+
if (ev.type !== 'user/message')
|
|
31
|
+
continue;
|
|
32
|
+
if (typeof ev.seq === 'number' && ev.seq <= bornAt)
|
|
33
|
+
continue;
|
|
34
|
+
const data = (ev.data ?? {});
|
|
35
|
+
if (!isHumanAuthored(data))
|
|
36
|
+
continue;
|
|
37
|
+
const message = (data.message ?? data);
|
|
38
|
+
const blocks = Array.isArray(message.content) ? message.content : [];
|
|
39
|
+
const text = blocks.filter((b) => b.type === 'text' && typeof b.text === 'string').map((b) => b.text).join('');
|
|
40
|
+
if (norm(stripReminderSpans(text).text) === want)
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
2
45
|
export function makePromptRoundRunner(deps) {
|
|
3
46
|
const chains = new Map();
|
|
4
47
|
const section = (id, job) => {
|
package/lib/prompt-runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-runner.js","sourceRoot":"","sources":["../src/prompt-runner.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,YAAY,EAA8B,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"prompt-runner.js","sourceRoot":"","sources":["../src/prompt-runner.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,aAAa,EAAE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AAC,EAAE,EAAE,EAAE,GAAG,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;oBACtH,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;oBAC3B,IAAI,CAAC,IAAI,EAAE,CAAC,gCAAgC,EAAE,KAAK,OAAO,EAAE,CAAC,CAAA;gBAC/D,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,EAAE,CAAC,iCAAiC,MAAM,CAAE,KAAe,EAAE,OAAO,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;QAC1G,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
package/lib/version.d.ts
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* reader cannot recover later, so it belongs in the bytes. A row in tests asserts this literal equals
|
|
7
7
|
* `package.json`'s version — the one place a hand-mirrored constant must never be allowed to drift.
|
|
8
8
|
*/
|
|
9
|
-
export declare const PLUGIN_VERSION = "0.2.
|
|
9
|
+
export declare const PLUGIN_VERSION = "0.2.25";
|
package/lib/version.js
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
* reader cannot recover later, so it belongs in the bytes. A row in tests asserts this literal equals
|
|
7
7
|
* `package.json`'s version — the one place a hand-mirrored constant must never be allowed to drift.
|
|
8
8
|
*/
|
|
9
|
-
export const PLUGIN_VERSION = '0.2.
|
|
9
|
+
export const PLUGIN_VERSION = '0.2.25';
|
|
10
10
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fractalsynapse/dsh-chapters",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25",
|
|
4
4
|
"description": "dsh plugin: verbatim chapter archive + zero-token index for small-context models",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"e2e:harness:live": "E2E_PROVIDER=harness MODE=live bash scripts/e2e-one.sh",
|
|
53
53
|
"corpus:heal": "E2E_PROVIDER=harness MODE=heal bash scripts/e2e-one.sh",
|
|
54
54
|
"corpus:record": "E2E_PROVIDER=harness MODE=record bash scripts/e2e-one.sh",
|
|
55
|
-
"test:e2e": "PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=suite && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=heavy && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=arrival && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=enrich && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=fanout && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=rules && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=fork && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=plans && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=prompt && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=prompt-off",
|
|
55
|
+
"test:e2e": "PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=suite && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=heavy && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=arrival && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=enrich && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=fanout && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=rules && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=fork && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=plans && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=prompt && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=prompt-off && PLAYWRIGHT_BROWSERS_PATH=$PWD/var/ms-playwright npx playwright test -c tests/e2e/playwright.config.ts --project=prompt-revival",
|
|
56
56
|
"test:all": "npm test && npm run test:e2e",
|
|
57
57
|
"test:integration": "node --test tests/integration/*.test.ts",
|
|
58
58
|
"test:e2e:record": "E2E_MODEL=record npm run test:e2e",
|