@sanqianx/project-knowledge 5.0.30 → 5.0.31
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +21 -0
- package/_site/_test/appearance-settings-test.js +148 -0
- package/_site/_test/helpers/parallel-capture-safety-r5-cap-shell.js +606 -0
- package/_site/_test/helpers/parallel-capture-safety-r5-memory-shell.js +464 -0
- package/_site/_test/helpers/parallel-dock-acceptance-env.js +301 -0
- package/_site/_test/helpers/parallel-dock-acceptance-r2-env.js +378 -0
- package/_site/_test/helpers/parallel-dock-acceptance-r2-ui.js +314 -0
- package/_site/_test/helpers/parallel-dock-acceptance-ui.js +195 -0
- package/_site/_test/helpers/parallel-dock-isolation-r3-credential-preload.js +113 -0
- package/_site/_test/helpers/parallel-dock-isolation-r3-env.js +307 -0
- package/_site/_test/helpers/parallel-dock-isolation-r3-fixture.js +373 -0
- package/_site/_test/helpers/parallel-dock-isolation-r3-ui.js +314 -0
- package/_site/_test/helpers/parallel-engine-reconcile-r4-harness.js +340 -0
- package/_site/_test/helpers/parallel-engine-reconcile-r4-standin-analyzer.js +82 -0
- package/_site/_test/helpers/parallel-memory-capture-r3-cap-shell.js +605 -0
- package/_site/_test/helpers/parallel-memory-capture-r3-shell.js +176 -0
- package/_site/_test/helpers/parallel-memory-capture-r4-cap-shell.js +577 -0
- package/_site/_test/helpers/parallel-memory-injection-shell.js +723 -0
- package/_site/_test/helpers/parallel-memory-injection-wb-host.js +81 -0
- package/_site/_test/helpers/parallel-workbench-drafts-r5-fixture.js +295 -0
- package/_site/_test/helpers/parallel-workbench-drafts-r5-harness.js +573 -0
- package/_site/_test/helpers/parallel-workbench-drafts-r5-host.js +69 -0
- package/_site/_test/helpers/parallel-workbench-runtime-harness.js +587 -0
- package/_site/_test/helpers/qa-r45-harness.js +94 -0
- package/_site/_test/helpers/qa-r48-env.js +64 -0
- package/_site/_test/helpers/qa-r51-env.cjs +77 -0
- package/_site/_test/parallel-capture-safety-r5-cap006-probe.js +524 -0
- package/_site/_test/parallel-capture-safety-r5-cap008e-probe.js +577 -0
- package/_site/_test/parallel-capture-safety-r5-mem005-health-test.js +320 -0
- package/_site/_test/parallel-engine-reconcile-r4-eng007-probe.js +304 -0
- package/_site/_test/parallel-logging-acceptance-log003-probe.js +78 -0
- package/_site/_test/parallel-logging-acceptance-log004-probe.js +85 -0
- package/_site/_test/parallel-memory-capture-r3-cap001-probe.js +238 -0
- package/_site/_test/parallel-memory-capture-r3-cap006-probe.js +371 -0
- package/_site/_test/parallel-memory-capture-r3-cap008-probe.js +439 -0
- package/_site/_test/parallel-memory-capture-r3-mem005-persistence-test.js +271 -0
- package/_site/_test/parallel-memory-capture-r4-cap006-probe.js +519 -0
- package/_site/_test/parallel-memory-capture-r4-cap008e-probe.js +569 -0
- package/_site/_test/parallel-memory-capture-r4-mem005-health-test.js +314 -0
- package/_site/_test/parallel-memory-injection-origin-probe.js +412 -0
- package/_site/_test/parallel-memory-injection-probe.js +411 -0
- package/_site/_test/parallel-workbench-drafts-r4-probe.js +477 -0
- package/_site/_test/parallel-workbench-drafts-r5-chrome-env-bisect.js +89 -0
- package/_site/_test/parallel-workbench-drafts-r5-probe.js +593 -0
- package/_site/_test/parallel-workbench-runtime-minimax-probe.js +321 -0
- package/_site/_test/parallel-workbench-runtime-wb004-ordering.js +307 -0
- package/_site/_test/parallel-workbench-runtime-wb005-drafts.js +313 -0
- package/_site/_test/parallel-workbench-runtime-wb008-abort.js +321 -0
- package/_site/_test/qa-r45-offline-backfill-test.js +279 -0
- package/_site/_test/qa-r48-sys003-blank-secret-test.js +258 -0
- package/_site/_test/t07c-cln-001-002-007-coverage-test.js +135 -0
- package/_site/_test/t07d-git-rel-coverage-test.js +224 -0
- package/_site/_test/t07e-qta-coverage-test.js +195 -0
- package/_site/_test/t07f-mem-008-coverage-test.js +101 -0
- package/_site/lib/server-app.js +11 -2
- package/_site/lib/settings-store.js +43 -1
- package/module-runtime-manifest.json +6 -6
- package/package.json +1 -1
- package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.mcp.json +1 -1
- package/ui/index.html +18 -1
- package/ui/product.css +6 -2
- package/ui/product.js +86 -1
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// P-WB-RUNTIME-03 / WB-003 — real MiniMax positive acceptance probe.
|
|
3
|
+
//
|
|
4
|
+
// The MiniMax subscription quota is refreshed (a real tool-input-delta was
|
|
5
|
+
// observed on the first RET line at 2026-10-23T07:38:15Z), so the positive
|
|
6
|
+
// acceptance that was BLOCKED on the old 429/2067 evidence is executed for
|
|
7
|
+
// real now — with the ORIGINAL minimax profile, read-only in memory.
|
|
8
|
+
//
|
|
9
|
+
// Model evidence is the same two-level scheme the r2 supplement established:
|
|
10
|
+
// * sdkReportedModel — the system/init model string the SDK reports for the
|
|
11
|
+
// session (what the CLI resolved locally);
|
|
12
|
+
// * vendorReturnedModel — message.model of the REAL assistant messages in
|
|
13
|
+
// the CLI transcript written under the ISOLATED CLAUDE_CONFIG_DIR,
|
|
14
|
+
// correlated to the same claudeSessionId and to the unique token echoed
|
|
15
|
+
// in that same transcript. This is the vendor-returned field.
|
|
16
|
+
//
|
|
17
|
+
// Everything else is unchanged from the frozen lane rules: the REAL installed
|
|
18
|
+
// module hosted standalone (no knowledge engine), the original profile store
|
|
19
|
+
// behind a read-only facade (every write method refuses), the credential only
|
|
20
|
+
// in memory, isolated HOME/CLAUDE_CONFIG_DIR/data/temp/ports, live ports
|
|
21
|
+
// refused, ambient credentials stripped, and a byte-level SHA256 comparison of
|
|
22
|
+
// the real profile directory before/after (digests never leave the process).
|
|
23
|
+
//
|
|
24
|
+
// Exactly ONE paid request. No quota endpoint, no retry loop, no PAYG.
|
|
25
|
+
//
|
|
26
|
+
// Exit codes: 0 = MiniMax positive acceptance positively proven;
|
|
27
|
+
// 3 = honestly BLOCKED (e.g. the vendor rejected the call);
|
|
28
|
+
// 1 = script error.
|
|
29
|
+
const assert = require('node:assert/strict');
|
|
30
|
+
const fs = require('node:fs');
|
|
31
|
+
const path = require('node:path');
|
|
32
|
+
const crypto = require('node:crypto');
|
|
33
|
+
const fixture = require('./helpers/parallel-workbench-fixture');
|
|
34
|
+
const sourceMap = require('./helpers/parallel-workbench-source-map');
|
|
35
|
+
|
|
36
|
+
const PROFILE_ID = String(process.env.PK_WB_MODEL_PROFILE || 'minimax');
|
|
37
|
+
const REQUESTED_MODEL = String(process.env.PK_WB_MODEL_ID || 'MiniMax-M3.1-Flash');
|
|
38
|
+
const TURN_TIMEOUT_MS = Number(process.env.PK_WB_TURN_TIMEOUT_MS || 420000);
|
|
39
|
+
|
|
40
|
+
const results = [];
|
|
41
|
+
function record(caseId, status, detail) {
|
|
42
|
+
results.push({ caseId, status, detail });
|
|
43
|
+
console.log(`CASE ${caseId} ${status} ${JSON.stringify(detail)}`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function getJson(url, options) {
|
|
47
|
+
const response = await fetch(url, { ...options, signal: AbortSignal.timeout(30000) });
|
|
48
|
+
const body = await response.json().catch(() => null);
|
|
49
|
+
return { status: response.status, ok: response.ok, body };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function consumeEvents(url, onEvent, until, timeoutMs) {
|
|
53
|
+
const controller = new AbortController();
|
|
54
|
+
const timer = setTimeout(() => controller.abort(new Error(`event stream timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
55
|
+
let done = null;
|
|
56
|
+
const finished = new Promise(resolve => { done = resolve; });
|
|
57
|
+
(async () => {
|
|
58
|
+
try {
|
|
59
|
+
const response = await fetch(url, { signal: controller.signal });
|
|
60
|
+
if (!response.ok) throw new Error(`event stream HTTP ${response.status}`);
|
|
61
|
+
const reader = response.body.getReader();
|
|
62
|
+
const decoder = new TextDecoder();
|
|
63
|
+
let buffer = '';
|
|
64
|
+
for (;;) {
|
|
65
|
+
const { value, done: streamDone } = await reader.read();
|
|
66
|
+
if (streamDone) break;
|
|
67
|
+
buffer += decoder.decode(value, { stream: true });
|
|
68
|
+
let index;
|
|
69
|
+
while ((index = buffer.indexOf('\n')) >= 0) {
|
|
70
|
+
const line = buffer.slice(0, index).replace(/\r$/, '');
|
|
71
|
+
buffer = buffer.slice(index + 1);
|
|
72
|
+
if (!line.startsWith('data:')) continue;
|
|
73
|
+
const payload = line.slice(5).trim();
|
|
74
|
+
if (!payload) continue;
|
|
75
|
+
let event;
|
|
76
|
+
try { event = JSON.parse(payload); } catch { continue; }
|
|
77
|
+
try { onEvent(event); } catch { /* listener errors never kill the stream */ }
|
|
78
|
+
if (until(event)) { controller.abort(); return; }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
} catch { /* aborted or ended */ }
|
|
82
|
+
finally { done && done(); }
|
|
83
|
+
})();
|
|
84
|
+
await finished;
|
|
85
|
+
clearTimeout(timer);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function walkFiles(root, visit) {
|
|
89
|
+
let names;
|
|
90
|
+
try { names = fs.readdirSync(root, { withFileTypes: true }); } catch { return; }
|
|
91
|
+
for (const entry of names) {
|
|
92
|
+
const full = path.join(root, entry.name);
|
|
93
|
+
if (entry.isDirectory()) walkFiles(full, visit);
|
|
94
|
+
else if (entry.isFile()) visit(full);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// The vendor-returned model of THIS session, read from the CLI transcript of
|
|
99
|
+
// the isolated host. Only file names, model strings and booleans leave here.
|
|
100
|
+
function scanTranscriptForVendorModel(roots, claudeSessionId, token) {
|
|
101
|
+
const matchedFiles = [];
|
|
102
|
+
const assistantModels = new Set();
|
|
103
|
+
let sessionCorrelated = false;
|
|
104
|
+
let tokenEchoed = false;
|
|
105
|
+
for (const root of roots) {
|
|
106
|
+
walkFiles(root, file => {
|
|
107
|
+
if (!file.endsWith('.jsonl')) return;
|
|
108
|
+
let text;
|
|
109
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch { return; }
|
|
110
|
+
if (claudeSessionId && !text.includes(claudeSessionId)) return;
|
|
111
|
+
matchedFiles.push(path.basename(file));
|
|
112
|
+
for (const line of text.split(/\r?\n/)) {
|
|
113
|
+
let entry;
|
|
114
|
+
try { entry = JSON.parse(line); } catch { continue; }
|
|
115
|
+
if (entry.type !== 'assistant' || !entry.message) continue;
|
|
116
|
+
const belongs = entry.sessionId === claudeSessionId
|
|
117
|
+
|| (entry.sessionId == null && claudeSessionId != null && text.includes(claudeSessionId));
|
|
118
|
+
if (!belongs) continue;
|
|
119
|
+
sessionCorrelated = true;
|
|
120
|
+
if (typeof entry.message.model === 'string' && entry.message.model) assistantModels.add(entry.message.model);
|
|
121
|
+
const content = Array.isArray(entry.message.content) ? entry.message.content : [];
|
|
122
|
+
for (const block of content) {
|
|
123
|
+
if (block && block.type === 'text' && typeof block.text === 'string' && block.text.includes(token)) tokenEchoed = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
transcriptFilesMatched: matchedFiles,
|
|
130
|
+
sessionCorrelated,
|
|
131
|
+
assistantModelValues: [...assistantModels],
|
|
132
|
+
tokenEchoedInTranscript: tokenEchoed,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const sameModel = (a, b) => String(a).replace(/\s+/g, '').toLowerCase() === String(b).replace(/\s+/g, '').toLowerCase();
|
|
137
|
+
|
|
138
|
+
(async () => {
|
|
139
|
+
const moduleRoot = fixture.resolveHostModuleRoot();
|
|
140
|
+
assert.ok(moduleRoot, 'no claude-ai-workbench module copy was found to host');
|
|
141
|
+
const identity = sourceMap.packageIdentity(moduleRoot);
|
|
142
|
+
const moduleRootLabel = moduleRoot === sourceMap.resolveInstalledProductPackage()
|
|
143
|
+
? 'currently-installed-package:installed-product'
|
|
144
|
+
: 'currently-installed-package:repository-pin';
|
|
145
|
+
|
|
146
|
+
const realProfilesBefore = fixture.digestDirectory(fixture.realWorkbenchProfileDir());
|
|
147
|
+
const layout = fixture.createIsolationLayout('parallel-wb-rt-minimax');
|
|
148
|
+
const port = await fixture.freePort();
|
|
149
|
+
const base = `http://127.0.0.1:${port}`;
|
|
150
|
+
const child = fixture.spawnNode([path.join(__dirname, 'helpers', 'parallel-workbench-host.js')], fixture.hostEnv(layout, {
|
|
151
|
+
PK_WB_MODULE_ROOT: moduleRoot,
|
|
152
|
+
PK_WB_HOST_PORT: String(port),
|
|
153
|
+
PK_WB_HOST_DATA_DIR: layout.dataDir,
|
|
154
|
+
PK_WB_HOST_WORKSPACE: layout.workspace,
|
|
155
|
+
PK_WB_HOST_MODE: 'standalone',
|
|
156
|
+
PK_WB_PROFILE_SOURCE: 'real-readonly',
|
|
157
|
+
}));
|
|
158
|
+
|
|
159
|
+
const token = `WBRT-MINIMAX-${crypto.randomBytes(5).toString('hex')}`;
|
|
160
|
+
const question = [
|
|
161
|
+
'这是一次真实 MiniMax 订阅模型正向抽测(Workbench WB-003 / P-WB-RUNTIME-03)。',
|
|
162
|
+
`请只回复一行,原样包含以下随机标记,不要添加任何其他内容:${token}`,
|
|
163
|
+
].join('\n');
|
|
164
|
+
|
|
165
|
+
let outcome = null;
|
|
166
|
+
try {
|
|
167
|
+
await fixture.waitForHttp(`${base}/api/claude-workbench/v1/health`, 30000);
|
|
168
|
+
|
|
169
|
+
const profiles = await getJson(`${base}/api/claude-workbench/v1/profiles`);
|
|
170
|
+
const listed = Array.isArray(profiles.body && profiles.body.profiles) ? profiles.body.profiles : [];
|
|
171
|
+
const target = listed.find(profile => profile.id === PROFILE_ID) || null;
|
|
172
|
+
record('WB-003.m1-profile-injected-readonly', target ? 'PASS' : 'BLOCKED', {
|
|
173
|
+
profileId: PROFILE_ID,
|
|
174
|
+
profileName: target && target.name,
|
|
175
|
+
baseUrl: target && target.baseUrl,
|
|
176
|
+
defaultModel: target && target.models && target.models.default,
|
|
177
|
+
credentialConfigured: target ? target.credentialConfigured === true : null,
|
|
178
|
+
storeWritesPossible: false,
|
|
179
|
+
credentialMaterialLogged: false,
|
|
180
|
+
});
|
|
181
|
+
assert.ok(target, `the ${PROFILE_ID} profile was not visible through the read-only facade`);
|
|
182
|
+
|
|
183
|
+
const session = await getJson(`${base}/api/claude-workbench/v1/sessions`, {
|
|
184
|
+
method: 'POST',
|
|
185
|
+
headers: { 'Content-Type': 'application/json' },
|
|
186
|
+
body: JSON.stringify({
|
|
187
|
+
context: { contextId: 'wbrt-minimax-probe', workspaceRef: 'wb-fixture' },
|
|
188
|
+
aiProfileId: PROFILE_ID,
|
|
189
|
+
model: REQUESTED_MODEL,
|
|
190
|
+
}),
|
|
191
|
+
});
|
|
192
|
+
const created = session.body && session.body.session;
|
|
193
|
+
record('WB-003.m2-session-with-subscription-profile', session.status === 201 && created ? 'PASS' : 'BLOCKED', {
|
|
194
|
+
httpStatus: session.status,
|
|
195
|
+
sessionId: created && created.sessionId,
|
|
196
|
+
model: created && created.model,
|
|
197
|
+
authSource: created && created.authSource,
|
|
198
|
+
});
|
|
199
|
+
assert.equal(session.status, 201);
|
|
200
|
+
const sessionId = created.sessionId;
|
|
201
|
+
assert.equal(created.authSource, 'profile-injected');
|
|
202
|
+
|
|
203
|
+
const events = [];
|
|
204
|
+
let settle = null;
|
|
205
|
+
const settled = new Promise(resolve => { settle = resolve; });
|
|
206
|
+
const isTerminal = event => event.type === 'claude/result';
|
|
207
|
+
const streamUrl = `${base}/api/claude-workbench/v1/sessions/${encodeURIComponent(sessionId)}/events`;
|
|
208
|
+
const consume = consumeEvents(streamUrl, event => {
|
|
209
|
+
if (['claude/init', 'claude/result', 'claude/error', 'claude/aborted'].includes(event.type)) events.push(event);
|
|
210
|
+
}, isTerminal, TURN_TIMEOUT_MS + 60000).catch(() => {});
|
|
211
|
+
|
|
212
|
+
const send = await getJson(`${base}/api/claude-workbench/v1/sessions/${encodeURIComponent(sessionId)}/input`, {
|
|
213
|
+
method: 'POST',
|
|
214
|
+
headers: { 'Content-Type': 'application/json' },
|
|
215
|
+
body: JSON.stringify({ text: question }),
|
|
216
|
+
});
|
|
217
|
+
record('WB-003.m3-unique-question-accepted', send.status === 202 ? 'PASS' : 'BLOCKED', { httpStatus: send.status, uniqueToken: token });
|
|
218
|
+
assert.equal(send.status, 202);
|
|
219
|
+
|
|
220
|
+
const deadline = Date.now() + TURN_TIMEOUT_MS;
|
|
221
|
+
while (Date.now() < deadline && !events.some(isTerminal)) {
|
|
222
|
+
await new Promise(resolve => setTimeout(resolve, 250));
|
|
223
|
+
}
|
|
224
|
+
settle && settle();
|
|
225
|
+
await Promise.race([consume, new Promise(resolve => setTimeout(resolve, 5000))]);
|
|
226
|
+
|
|
227
|
+
const init = events.find(event => event.type === 'claude/init') || null;
|
|
228
|
+
const result = events.find(event => event.type === 'claude/result') || null;
|
|
229
|
+
const error = events.find(event => event.type === 'claude/error') || null;
|
|
230
|
+
const sdkReportedModel = init ? init.model : null;
|
|
231
|
+
const claudeSessionId = init ? init.claudeSessionId : null;
|
|
232
|
+
const answer = result ? String(result.result || '') : '';
|
|
233
|
+
const tokenEchoed = answer.includes(token);
|
|
234
|
+
const isError = result ? result.isError === true : true;
|
|
235
|
+
|
|
236
|
+
const transcript = scanTranscriptForVendorModel([layout.claudeConfigDir, path.join(layout.home, '.claude')], claudeSessionId, token);
|
|
237
|
+
const vendorModels = transcript.assistantModelValues;
|
|
238
|
+
const vendorModelProven = transcript.sessionCorrelated
|
|
239
|
+
&& vendorModels.length > 0
|
|
240
|
+
&& transcript.tokenEchoedInTranscript
|
|
241
|
+
&& vendorModels.every(model => sameModel(model, REQUESTED_MODEL));
|
|
242
|
+
|
|
243
|
+
record('WB-003.m4-vendor-returned-model', vendorModelProven ? 'PASS' : 'BLOCKED', {
|
|
244
|
+
requestedModel: REQUESTED_MODEL,
|
|
245
|
+
sdkReportedModel,
|
|
246
|
+
assistantModelValues: vendorModels,
|
|
247
|
+
vendorModelMatchesRequest: vendorModels.length > 0 ? vendorModels.every(model => sameModel(model, REQUESTED_MODEL)) : null,
|
|
248
|
+
sessionCorrelated: transcript.sessionCorrelated,
|
|
249
|
+
tokenEchoedInTranscript: transcript.tokenEchoedInTranscript,
|
|
250
|
+
transcriptFilesMatched: transcript.transcriptFilesMatched,
|
|
251
|
+
detail: 'message.model of the real assistant messages in the CLI transcript under the ISOLATED CLAUDE_CONFIG_DIR, correlated by claudeSessionId and the unique token echo',
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
record('WB-003.m5-response-correlated', !isError && tokenEchoed ? 'PASS' : 'BLOCKED', {
|
|
255
|
+
isError,
|
|
256
|
+
uniqueToken: token,
|
|
257
|
+
tokenEchoedInAnswer: tokenEchoed,
|
|
258
|
+
claudeSessionId,
|
|
259
|
+
workbenchSessionId: sessionId,
|
|
260
|
+
answerPreview: answer.slice(0, 200),
|
|
261
|
+
errorEvent: error,
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
outcome = {
|
|
265
|
+
requestedModel: REQUESTED_MODEL,
|
|
266
|
+
sdkReportedModel,
|
|
267
|
+
vendorReturnedModels: vendorModels,
|
|
268
|
+
vendorModelProven,
|
|
269
|
+
claudeSessionId,
|
|
270
|
+
workbenchSessionId: sessionId,
|
|
271
|
+
isError,
|
|
272
|
+
tokenEchoed,
|
|
273
|
+
answerPreview: answer.slice(0, 200),
|
|
274
|
+
usage: result && result.usage ? { inputTokens: result.usage.input_tokens, outputTokens: result.usage.output_tokens } : null,
|
|
275
|
+
};
|
|
276
|
+
} finally {
|
|
277
|
+
child.child.kill();
|
|
278
|
+
await child.exited;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
const digestComparison = fixture.compareDigests(realProfilesBefore, fixture.digestDirectory(fixture.realWorkbenchProfileDir()));
|
|
282
|
+
record('WB-003.m6-real-profiles-byte-identical', digestComparison.byteIdentical ? 'PASS' : 'FAIL', {
|
|
283
|
+
profileDir: fixture.realWorkbenchProfileDir(),
|
|
284
|
+
comparison: 'byte-level SHA256, computed in memory; digests never printed, logged or persisted',
|
|
285
|
+
fileCount: digestComparison.count,
|
|
286
|
+
changedFiles: digestComparison.changedFiles,
|
|
287
|
+
addedFiles: digestComparison.addedFiles,
|
|
288
|
+
removedFiles: digestComparison.removedFiles,
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
const essential = ['WB-003.m1-profile-injected-readonly', 'WB-003.m2-session-with-subscription-profile', 'WB-003.m3-unique-question-accepted', 'WB-003.m4-vendor-returned-model', 'WB-003.m5-response-correlated', 'WB-003.m6-real-profiles-byte-identical'];
|
|
292
|
+
const proven = essential.every(id => (results.find(entry => entry.caseId === id) || {}).status === 'PASS');
|
|
293
|
+
|
|
294
|
+
const summary = {
|
|
295
|
+
lane: 'test-workbench-runtime',
|
|
296
|
+
file: 'parallel-workbench-runtime-minimax-probe.js',
|
|
297
|
+
case: 'WB-003',
|
|
298
|
+
title: '真实模型抽测(MiniMax 正向验收)',
|
|
299
|
+
module: { label: moduleRootLabel, root: moduleRoot, name: identity.name, version: identity.version },
|
|
300
|
+
host: { mode: 'standalone', engineUrlConfigured: false, dataDir: layout.dataDir, workspace: layout.workspace },
|
|
301
|
+
profile: { id: PROFILE_ID, source: 'original-subscription-store read-only, credential in memory only', credentialWrittenAnywhere: false },
|
|
302
|
+
turn: outcome,
|
|
303
|
+
cases: results,
|
|
304
|
+
verdict: proven ? 'PASS (MiniMax positive acceptance proven: vendor-returned model + unique fact + session correlation)' : 'BLOCKED',
|
|
305
|
+
paidTurnsSent: 1,
|
|
306
|
+
quotaEndpointQueried: false,
|
|
307
|
+
networkUsed: true,
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const target = process.env.PARALLEL_WORKBENCH_RUNTIME_EVIDENCE;
|
|
311
|
+
if (target) {
|
|
312
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
313
|
+
fs.writeFileSync(target, JSON.stringify(summary, null, 2), 'utf8');
|
|
314
|
+
}
|
|
315
|
+
fixture.removeTree(layout.root);
|
|
316
|
+
console.log(`parallel-workbench-runtime-minimax-probe verdict=${summary.verdict}`);
|
|
317
|
+
process.exitCode = proven ? 0 : 3;
|
|
318
|
+
})().catch(error => {
|
|
319
|
+
console.error(error);
|
|
320
|
+
process.exitCode = 1;
|
|
321
|
+
});
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// WB-004 — 连续回复次序(真实浏览器 / 真实 0.13.6 隔离宿主 / 真实 MiniMax)。
|
|
3
|
+
//
|
|
4
|
+
// 本入口用真实 Chrome 打开模块自带的 agent-terminal UI(安装包内
|
|
5
|
+
// apps/agent-terminal),在隔离宿主上跑本轮真实 Q1 与 Q2:
|
|
6
|
+
//
|
|
7
|
+
// * Q1 结束后立即发 Q2(同一会话);
|
|
8
|
+
// * 故障注入 = 把本轮真实 Q1 的一条真实事件在 Q2 进行中【延迟重放】回
|
|
9
|
+
// 同一条 SSE 流。重放由页面内的记录器完成,记录器只记录与重放,不做
|
|
10
|
+
// 过滤、不改顺序、不替产品判断;
|
|
11
|
+
// * 判定只看产品自身的 UI 与活动状态:Q1 正文不在 Q2 之后重复、Q2 不被
|
|
12
|
+
// 错误置为 idle。
|
|
13
|
+
//
|
|
14
|
+
// 退出码:0 = 全部证明;3 = 诚实 BLOCKED;1 = 脚本错误。
|
|
15
|
+
const fs = require('node:fs');
|
|
16
|
+
const path = require('node:path');
|
|
17
|
+
const crypto = require('node:crypto');
|
|
18
|
+
const fixture = require('./helpers/parallel-workbench-fixture');
|
|
19
|
+
const harness = require('./helpers/parallel-workbench-runtime-harness');
|
|
20
|
+
|
|
21
|
+
const PROFILE_ID = String(process.env.PK_WB_MODEL_PROFILE || 'minimax');
|
|
22
|
+
const REQUESTED_MODEL = String(process.env.PK_WB_MODEL_ID || 'MiniMax-M3.1-Flash');
|
|
23
|
+
const TURN_TIMEOUT_MS = Number(process.env.PK_WB_TURN_TIMEOUT_MS || 420000);
|
|
24
|
+
|
|
25
|
+
const results = [];
|
|
26
|
+
function record(caseId, status, detail) {
|
|
27
|
+
results.push({ caseId, status, detail });
|
|
28
|
+
console.log(`CASE ${caseId} ${status} ${JSON.stringify(detail)}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// The vendor-returned model of this run: the assistant message.model of the
|
|
32
|
+
// real CLI transcript under the ISOLATED CLAUDE_CONFIG_DIR. Only model
|
|
33
|
+
// strings and booleans leave here.
|
|
34
|
+
function scanTranscript(roots, sessionIds, tokens) {
|
|
35
|
+
const matched = [];
|
|
36
|
+
const models = new Set();
|
|
37
|
+
let tokenEchoed = false;
|
|
38
|
+
const walk = root => {
|
|
39
|
+
let entries;
|
|
40
|
+
try { entries = fs.readdirSync(root, { withFileTypes: true }); } catch { return; }
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
const full = path.join(root, entry.name);
|
|
43
|
+
if (entry.isDirectory()) { walk(full); continue; }
|
|
44
|
+
if (!entry.isFile() || !full.endsWith('.jsonl')) continue;
|
|
45
|
+
let text;
|
|
46
|
+
try { text = fs.readFileSync(full, 'utf8'); } catch { continue; }
|
|
47
|
+
if (!sessionIds.some(id => text.includes(id))) continue;
|
|
48
|
+
matched.push(path.basename(full));
|
|
49
|
+
for (const line of text.split(/\r?\n/)) {
|
|
50
|
+
let entry;
|
|
51
|
+
try { entry = JSON.parse(line); } catch { continue; }
|
|
52
|
+
if (entry.type !== 'assistant' || !entry.message) continue;
|
|
53
|
+
if (typeof entry.message.model === 'string' && entry.message.model) models.add(entry.message.model);
|
|
54
|
+
const content = Array.isArray(entry.message.content) ? entry.message.content : [];
|
|
55
|
+
for (const block of content) {
|
|
56
|
+
if (block && block.type === 'text' && typeof block.text === 'string' && tokens.some(token => block.text.includes(token))) tokenEchoed = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
for (const root of roots) walk(root);
|
|
62
|
+
return { transcriptFilesMatched: matched, assistantModelValues: [...models], tokenEchoedInTranscript: tokenEchoed };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
(async () => {
|
|
66
|
+
const realProfilesBefore = fixture.digestDirectory(fixture.realWorkbenchProfileDir());
|
|
67
|
+
const host = await harness.startHost({ prefix: 'parallel-wb004' });
|
|
68
|
+
const identity = harness.moduleIdentity(host.moduleRoot);
|
|
69
|
+
let browser = null;
|
|
70
|
+
let ui = null;
|
|
71
|
+
let outcome = null;
|
|
72
|
+
let blocked = null;
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const opened = await harness.openBrowser(host.base, host.layout);
|
|
76
|
+
browser = opened.browser;
|
|
77
|
+
ui = opened;
|
|
78
|
+
|
|
79
|
+
const health = await harness.getJson(`${host.base}${harness.API_BASE}/health`);
|
|
80
|
+
const project = await harness.ensureProject(browser, path.join(host.layout.root, 'wb004-project'), { name: 'wb004-project' });
|
|
81
|
+
record('WB-004.a-real-browser-and-host', health.ok && health.body && health.body.status === 'ok' ? 'PASS' : 'BLOCKED', {
|
|
82
|
+
browser: 'real Chrome via CDP (headless), isolated user-data-dir below the isolated layout',
|
|
83
|
+
chrome: opened.chrome,
|
|
84
|
+
module: identity,
|
|
85
|
+
host: { mode: 'standalone', dataDir: host.layout.dataDir, workspace: host.layout.workspace, port: host.port },
|
|
86
|
+
project: { id: project.projectId, name: project.name, createdThroughTheProductForm: project.created === true },
|
|
87
|
+
health: health.body,
|
|
88
|
+
});
|
|
89
|
+
assertTrue(health.ok && health.body && health.body.status === 'ok', 'the isolated host is not healthy');
|
|
90
|
+
|
|
91
|
+
const profiles = await harness.getJson(`${host.base}${harness.API_BASE}/profiles`);
|
|
92
|
+
const listed = Array.isArray(profiles.body && profiles.body.profiles) ? profiles.body.profiles : [];
|
|
93
|
+
const profile = listed.find(item => item.id === PROFILE_ID) || null;
|
|
94
|
+
assertTrue(profile, `the ${PROFILE_ID} profile is not visible through the read-only facade`);
|
|
95
|
+
const credentialConfigured = profile.credentialConfigured === true;
|
|
96
|
+
|
|
97
|
+
await harness.selectModel(browser, profile.name, REQUESTED_MODEL);
|
|
98
|
+
const afterModel = await harness.readState(browser);
|
|
99
|
+
record('WB-004.b-model-selected-through-the-real-ui', credentialConfigured && afterModel.product.currentProfileId === PROFILE_ID && afterModel.product.currentModel === REQUESTED_MODEL ? 'PASS' : 'BLOCKED', {
|
|
100
|
+
profileId: PROFILE_ID,
|
|
101
|
+
profileName: profile.name,
|
|
102
|
+
requestedModel: REQUESTED_MODEL,
|
|
103
|
+
uiProfileId: afterModel.product.currentProfileId,
|
|
104
|
+
uiModel: afterModel.product.currentModel,
|
|
105
|
+
modelLabel: afterModel.modelLabel,
|
|
106
|
+
credentialConfigured,
|
|
107
|
+
credentialWrittenAnywhere: false,
|
|
108
|
+
});
|
|
109
|
+
assertTrue(credentialConfigured, 'the profile has no configured credential');
|
|
110
|
+
|
|
111
|
+
const token1 = `WBRT-ORDER-A-${crypto.randomBytes(5).toString('hex')}`;
|
|
112
|
+
const token2 = `WBRT-ORDER-B-${crypto.randomBytes(5).toString('hex')}`;
|
|
113
|
+
const question1 = `这是 WB-004 连续回复次序的真实抽测(第 1 问)。请只回复一行,原样包含以下随机标记,不要添加任何其他内容:${token1}`;
|
|
114
|
+
const question2 = `这是 WB-004 连续回复次序的真实抽测(第 2 问)。请先输出一行、原样包含以下随机标记:${token2};然后再写三行简短说明,说明这是第 2 问。`;
|
|
115
|
+
|
|
116
|
+
// --- Q1 -------------------------------------------------------------
|
|
117
|
+
await harness.typeText(browser, question1);
|
|
118
|
+
await harness.clickSend(browser);
|
|
119
|
+
const q1Busy = await harness.waitForState(browser, state => state.busy === true, 'Q1 to start', 90000);
|
|
120
|
+
const q1Done = await harness.waitForState(browser, state => state.busy === false && state.product.liveRevision > 0, 'Q1 to end', TURN_TIMEOUT_MS);
|
|
121
|
+
const q1Text = q1Done.streamText;
|
|
122
|
+
const q1Answers = q1Done.assistantMessages.filter(text => text.includes(token1));
|
|
123
|
+
const q1Count = q1Answers.length;
|
|
124
|
+
record('WB-004.c-q1-answered-by-the-real-model', q1Count === 1 ? 'PASS' : 'BLOCKED', {
|
|
125
|
+
uniqueToken: token1,
|
|
126
|
+
assistantAnswersCarryingTheToken: q1Count,
|
|
127
|
+
answerPreview: q1Answers.length ? q1Answers[0].slice(0, 200) : q1Text.slice(-200),
|
|
128
|
+
uiSessionState: q1Done.product.sessionState,
|
|
129
|
+
paidTurns: 1,
|
|
130
|
+
});
|
|
131
|
+
assertTrue(q1Count === 1, `Q1 was not answered with the unique token (${q1Count} assistant answers carry it)`);
|
|
132
|
+
|
|
133
|
+
// --- Q2 immediately --------------------------------------------------
|
|
134
|
+
const q1ResultEvent = (await harness.recordedEvents(browser))
|
|
135
|
+
.filter(event => event.type === 'claude/result' && event.data.includes(token1))
|
|
136
|
+
.pop() || null;
|
|
137
|
+
const q2SentAt = Date.now();
|
|
138
|
+
await harness.typeText(browser, question2);
|
|
139
|
+
await harness.clickSend(browser);
|
|
140
|
+
const q2Busy = await harness.waitForState(browser, state => state.busy === true, 'Q2 to start', 90000);
|
|
141
|
+
const gapMs = q1ResultEvent ? q2SentAt - q1ResultEvent.at : null;
|
|
142
|
+
record('WB-004.d-q2-sent-immediately-after-q1', gapMs !== null && gapMs < 10000 ? 'PASS' : 'BLOCKED', {
|
|
143
|
+
q1ResultEventAt: q1ResultEvent ? q1ResultEvent.at : null,
|
|
144
|
+
q2SentAt,
|
|
145
|
+
gapMs,
|
|
146
|
+
sameSession: q1Busy.product.activeSessionId === q2Busy.product.activeSessionId,
|
|
147
|
+
sessionId: q2Busy.product.activeSessionId,
|
|
148
|
+
});
|
|
149
|
+
assertTrue(gapMs !== null && gapMs < 10000, 'Q2 was not sent immediately after Q1');
|
|
150
|
+
|
|
151
|
+
// The fault injection lands while Q2 is still running: the replay is
|
|
152
|
+
// issued as soon as the UI reports Q2 busy, and the product's answer to
|
|
153
|
+
// the stale event is read back immediately afterwards.
|
|
154
|
+
const beforeReplay = await harness.readState(browser);
|
|
155
|
+
assertTrue(beforeReplay.busy === true, 'Q2 was no longer running when the fault injection was due');
|
|
156
|
+
const events = await harness.recordedEvents(browser);
|
|
157
|
+
const q1ResultIndex = events.findIndex(event => event.type === 'claude/result' && event.data.includes(token1));
|
|
158
|
+
assertTrue(q1ResultIndex >= 0, 'the real Q1 result event was not recorded by the product stream');
|
|
159
|
+
const q1ResultData = events[q1ResultIndex].data;
|
|
160
|
+
const replay = await harness.replayRecordedEvent(browser, q1ResultIndex, `/sessions/${q2Busy.product.activeSessionId}/events`);
|
|
161
|
+
await harness.wait(400);
|
|
162
|
+
const afterReplay = await harness.readState(browser);
|
|
163
|
+
const replayedEvents = await harness.recordedEvents(browser);
|
|
164
|
+
const matches = event => event.type === 'claude/result' && event.data === q1ResultData;
|
|
165
|
+
const delivered = replayedEvents.filter(matches).length - events.filter(matches).length;
|
|
166
|
+
|
|
167
|
+
const q1AfterReplay = afterReplay.assistantMessages.filter(text => text.includes(token1)).length;
|
|
168
|
+
const q2DuringReplay = afterReplay.assistantMessages.filter(text => text.includes(token2)).length;
|
|
169
|
+
const assistantCountBefore = beforeReplay.assistantMessages.length;
|
|
170
|
+
const assistantCountAfter = afterReplay.assistantMessages.length;
|
|
171
|
+
const staleDropped = q1AfterReplay === 1 && assistantCountAfter === assistantCountBefore;
|
|
172
|
+
const stillBusy = afterReplay.busy === true && afterReplay.product.sessionState !== 'idle';
|
|
173
|
+
record('WB-004.e-stale-q1-message-replayed-into-the-live-q2-turn', staleDropped && stillBusy ? 'PASS' : 'BLOCKED', {
|
|
174
|
+
injectedEvent: { index: q1ResultIndex, type: events[q1ResultIndex].type, sequence: (() => { try { return JSON.parse(q1ResultData).sequence; } catch { return null; } })() },
|
|
175
|
+
replayResult: replay,
|
|
176
|
+
timesTheSameRealQ1EventReachedTheProduct: delivered,
|
|
177
|
+
productLiveRevisionBefore: beforeReplay.product.liveRevision,
|
|
178
|
+
productLiveRevisionAfter: afterReplay.product.liveRevision,
|
|
179
|
+
staleEventAcceptedByTheProduct: !staleDropped,
|
|
180
|
+
assistantMessagesBeforeReplay: assistantCountBefore,
|
|
181
|
+
assistantMessagesAfterReplay: assistantCountAfter,
|
|
182
|
+
q1BodyOccurrencesAfterReplay: q1AfterReplay,
|
|
183
|
+
q2BodyOccurrencesDuringReplay: q2DuringReplay,
|
|
184
|
+
uiBusyAfterReplay: afterReplay.busy,
|
|
185
|
+
uiSessionStateAfterReplay: afterReplay.product.sessionState,
|
|
186
|
+
uiStatusTextAfterReplay: afterReplay.statusText,
|
|
187
|
+
note: 'the replayed frame is byte-identical to the real Q1 result frame of this round and is delivered to the very same session SSE stream the product reads; whether it is rendered is decided by the product\'s own session-sequence guard (apps/agent-terminal/app.js)',
|
|
188
|
+
});
|
|
189
|
+
assertTrue(replay.replayed === true && replay.delivered >= 1, 'the replayed Q1 message never reached the product');
|
|
190
|
+
assertTrue(delivered >= 1, 'the replayed Q1 message did not reach the product a second time');
|
|
191
|
+
assertTrue(staleDropped, 'the product rendered the stale Q1 event (Q1 body repeated)');
|
|
192
|
+
assertTrue(stillBusy, 'Q2 was wrongly put into idle by the stale Q1 event');
|
|
193
|
+
|
|
194
|
+
// --- Q2 completes ----------------------------------------------------
|
|
195
|
+
const q2Done = await harness.waitForState(browser, state => state.busy === false && state.assistantMessages.filter(text => text.includes(token2)).length === 1, 'Q2 to end', TURN_TIMEOUT_MS);
|
|
196
|
+
const finalAnswers = q2Done.assistantMessages;
|
|
197
|
+
const q1Indexes = finalAnswers.map((text, index) => (text.includes(token1) ? index : -1)).filter(index => index >= 0);
|
|
198
|
+
const q2Indexes = finalAnswers.map((text, index) => (text.includes(token2) ? index : -1)).filter(index => index >= 0);
|
|
199
|
+
const q1Final = q1Indexes.length;
|
|
200
|
+
const q2Final = q2Indexes.length;
|
|
201
|
+
const order = q1Final === 1 && q2Final === 1 && q1Indexes[0] < q2Indexes[0];
|
|
202
|
+
record('WB-004.f-q2-completed-with-its-own-answer', order ? 'PASS' : 'BLOCKED', {
|
|
203
|
+
assistantMessageCount: finalAnswers.length,
|
|
204
|
+
q1Answers: q1Final,
|
|
205
|
+
q2Answers: q2Final,
|
|
206
|
+
q1BeforeQ2InTheTranscript: order,
|
|
207
|
+
uiSessionState: q2Done.product.sessionState,
|
|
208
|
+
paidTurns: 2,
|
|
209
|
+
});
|
|
210
|
+
assertTrue(order, 'the final transcript does not hold exactly one Q1 and one Q2 answer in order');
|
|
211
|
+
|
|
212
|
+
// --- the vendor-returned model of this run ---------------------------
|
|
213
|
+
const sessionId = q2Done.product.activeSessionId;
|
|
214
|
+
const initEvents = (await harness.recordedEvents(browser)).filter(event => event.type === 'claude/init');
|
|
215
|
+
const claudeSessionIds = initEvents.map(event => { try { return JSON.parse(event.data).claudeSessionId; } catch { return null; } }).filter(Boolean);
|
|
216
|
+
const transcript = scanTranscript(
|
|
217
|
+
[host.layout.claudeConfigDir, path.join(host.layout.home, '.claude')],
|
|
218
|
+
claudeSessionIds,
|
|
219
|
+
[token1, token2],
|
|
220
|
+
);
|
|
221
|
+
const vendorModelOk = transcript.assistantModelValues.length > 0
|
|
222
|
+
&& transcript.assistantModelValues.every(model => model.replace(/\s+/g, '').toLowerCase() === REQUESTED_MODEL.replace(/\s+/g, '').toLowerCase())
|
|
223
|
+
&& transcript.tokenEchoedInTranscript;
|
|
224
|
+
record('WB-004.g-vendor-returned-model-from-the-real-transcript', vendorModelOk ? 'PASS' : 'BLOCKED', {
|
|
225
|
+
requestedModel: REQUESTED_MODEL,
|
|
226
|
+
assistantModelValues: transcript.assistantModelValues,
|
|
227
|
+
tokenEchoedInTranscript: transcript.tokenEchoedInTranscript,
|
|
228
|
+
transcriptFilesMatched: transcript.transcriptFilesMatched,
|
|
229
|
+
claudeSessionIds,
|
|
230
|
+
workbenchSessionId: sessionId,
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
outcome = {
|
|
234
|
+
workbenchSessionId: sessionId,
|
|
235
|
+
q1Token: token1,
|
|
236
|
+
q2Token: token2,
|
|
237
|
+
gapMs,
|
|
238
|
+
q1FinalOccurrences: q1Final,
|
|
239
|
+
q2FinalOccurrences: q2Final,
|
|
240
|
+
vendorReturnedModels: transcript.assistantModelValues,
|
|
241
|
+
paidTurns: 2,
|
|
242
|
+
};
|
|
243
|
+
} catch (error) {
|
|
244
|
+
blocked = { message: String(error && error.message ? error.message : error) };
|
|
245
|
+
record('WB-004.runtime', 'BLOCKED', { error: blocked.message });
|
|
246
|
+
} finally {
|
|
247
|
+
if (browser) { try { await browser.close(); } catch { /* the browser is disposable */ } }
|
|
248
|
+
if (host.child) { await harness.stopHost(host); }
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const digestComparison = fixture.compareDigests(realProfilesBefore, fixture.digestDirectory(fixture.realWorkbenchProfileDir()));
|
|
252
|
+
record('WB-004.h-real-profiles-byte-identical', digestComparison.byteIdentical ? 'PASS' : 'FAIL', {
|
|
253
|
+
profileDir: fixture.realWorkbenchProfileDir(),
|
|
254
|
+
comparison: 'byte-level SHA256, computed in memory; digests never printed, logged or persisted',
|
|
255
|
+
fileCount: digestComparison.count,
|
|
256
|
+
changedFiles: digestComparison.changedFiles,
|
|
257
|
+
addedFiles: digestComparison.addedFiles,
|
|
258
|
+
removedFiles: digestComparison.removedFiles,
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
const essential = [
|
|
262
|
+
'WB-004.a-real-browser-and-host',
|
|
263
|
+
'WB-004.b-model-selected-through-the-real-ui',
|
|
264
|
+
'WB-004.c-q1-answered-by-the-real-model',
|
|
265
|
+
'WB-004.d-q2-sent-immediately-after-q1',
|
|
266
|
+
'WB-004.e-stale-q1-message-replayed-into-the-live-q2-turn',
|
|
267
|
+
'WB-004.f-q2-completed-with-its-own-answer',
|
|
268
|
+
'WB-004.g-vendor-returned-model-from-the-real-transcript',
|
|
269
|
+
'WB-004.h-real-profiles-byte-identical',
|
|
270
|
+
];
|
|
271
|
+
const proven = essential.every(id => (results.find(entry => entry.caseId === id) || {}).status === 'PASS');
|
|
272
|
+
|
|
273
|
+
const summary = {
|
|
274
|
+
lane: 'test-workbench-runtime',
|
|
275
|
+
file: 'parallel-workbench-runtime-wb004-ordering.js',
|
|
276
|
+
case: 'WB-004',
|
|
277
|
+
title: '连续回复次序(真实浏览器 + 真实模型 + 故障注入)',
|
|
278
|
+
module: identity,
|
|
279
|
+
host: { mode: 'standalone', engineUrlConfigured: false, dataDir: host.layout.dataDir, workspace: host.layout.workspace },
|
|
280
|
+
profile: { id: PROFILE_ID, source: 'original-subscription-store read-only, credential in memory only', credentialWrittenAnywhere: false },
|
|
281
|
+
faultInjection: 'a real Q1 event of this round, recorded on the product\'s own SSE stream, is delivered a second time to that same stream while Q2 is running',
|
|
282
|
+
turn: outcome,
|
|
283
|
+
cases: results,
|
|
284
|
+
verdict: proven ? 'PASS (ordering proven: no repeated Q1 body, no wrongly idle Q2)' : 'BLOCKED',
|
|
285
|
+
paidTurnsSent: outcome ? outcome.paidTurns : 0,
|
|
286
|
+
quotaEndpointQueried: false,
|
|
287
|
+
networkUsed: true,
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
const evidenceTarget = process.env.PARALLEL_WORKBENCH_RUNTIME_EVIDENCE;
|
|
291
|
+
harness.writeEvidence(evidenceTarget, summary);
|
|
292
|
+
if (!proven) {
|
|
293
|
+
// A real API error keeps the scene: the isolated layout is left on disk.
|
|
294
|
+
console.log(`SCENE KEPT ${host.layout.root}`);
|
|
295
|
+
} else {
|
|
296
|
+
fixture.removeTree(host.layout.root);
|
|
297
|
+
}
|
|
298
|
+
console.log(`parallel-workbench-runtime-wb004-ordering verdict=${summary.verdict}`);
|
|
299
|
+
process.exitCode = proven ? 0 : 3;
|
|
300
|
+
})().catch(error => {
|
|
301
|
+
console.error(error);
|
|
302
|
+
process.exitCode = 1;
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
function assertTrue(condition, message) {
|
|
306
|
+
if (!condition) throw new Error(message);
|
|
307
|
+
}
|