feat: sync g14 harness and device-pod cli
This commit is contained in:
@@ -163,6 +163,93 @@ test("hwlab-cli client agent trace shows assistant stream text in compact output
|
||||
assert.equal(result.payload.body.eventsCount, 1);
|
||||
});
|
||||
|
||||
test("hwlab-cli client harness submits waits and audits trace friction", async () => {
|
||||
const calls: any[] = [];
|
||||
const result = await runHwlabCli([
|
||||
"client",
|
||||
"harness",
|
||||
"submit",
|
||||
"--base-url",
|
||||
"http://web.test",
|
||||
"--cookie",
|
||||
"hwlab_session=session-a",
|
||||
"--message",
|
||||
"hello",
|
||||
"--trace-id",
|
||||
"trc_harness",
|
||||
"--conversation-id",
|
||||
"cnv_harness"
|
||||
], {
|
||||
fetchImpl: async (url, init) => {
|
||||
calls.push({ url: String(url), init, body: JSON.parse(String(init?.body ?? "{}")) });
|
||||
return new Response(JSON.stringify({
|
||||
accepted: true,
|
||||
status: "running",
|
||||
resultUrl: "/v1/agent/chat/result/trc_harness",
|
||||
traceUrl: "/v1/agent/chat/trace/trc_harness"
|
||||
}), { status: 202 });
|
||||
}
|
||||
});
|
||||
assert.equal(result.exitCode, 0);
|
||||
assert.equal(result.payload.action, "client.harness.submit");
|
||||
assert.equal(calls[0].url, "http://web.test/v1/agent/chat");
|
||||
assert.equal(calls[0].init.headers.prefer, "respond-async");
|
||||
assert.equal(calls[0].body.shortConnection, true);
|
||||
|
||||
let polls = 0;
|
||||
const wait = await runHwlabCli([
|
||||
"client",
|
||||
"harness-opt",
|
||||
"wait",
|
||||
"trc_harness",
|
||||
"--base-url",
|
||||
"http://web.test",
|
||||
"--cookie",
|
||||
"hwlab_session=session-a",
|
||||
"--poll-interval-ms",
|
||||
"1",
|
||||
"--timeout-ms",
|
||||
"1000"
|
||||
], {
|
||||
fetchImpl: async () => {
|
||||
polls += 1;
|
||||
return new Response(JSON.stringify(polls === 1
|
||||
? { status: "running", traceId: "trc_harness" }
|
||||
: { status: "completed", traceId: "trc_harness", reply: { content: "done" } }), { status: 200 });
|
||||
},
|
||||
sleep: async () => {}
|
||||
});
|
||||
assert.equal(wait.exitCode, 0);
|
||||
assert.equal(wait.payload.timedOut, false);
|
||||
assert.equal(wait.payload.body.assistantText, "done");
|
||||
|
||||
const audit = await runHwlabCli([
|
||||
"client",
|
||||
"harness",
|
||||
"audit",
|
||||
"trc_harness",
|
||||
"--require-bootsharp",
|
||||
"--base-url",
|
||||
"http://web.test",
|
||||
"--cookie",
|
||||
"hwlab_session=session-a"
|
||||
], {
|
||||
fetchImpl: async () => new Response(JSON.stringify({
|
||||
traceId: "trc_harness",
|
||||
events: [
|
||||
{
|
||||
type: "tool_call",
|
||||
command: "node /app/tools/device-pod-cli.mjs device-pod-a:workspace:/ put User/main.c"
|
||||
}
|
||||
]
|
||||
}), { status: 200 })
|
||||
});
|
||||
assert.equal(audit.exitCode, 0);
|
||||
assert.equal(audit.payload.status, "friction_detected");
|
||||
assert.ok(audit.payload.frictionSignals.some((signal) => signal.kind === "workspace_put_text_edit"));
|
||||
assert.ok(audit.payload.frictionSignals.some((signal) => signal.kind === "missing_bootsharp"));
|
||||
});
|
||||
|
||||
test("hwlab-cli client workbench summary probes Cloud Web non-visual surfaces", async () => {
|
||||
const seen: string[] = [];
|
||||
const result = await runHwlabCli(["client", "workbench", "summary", "--base-url", "http://web.test", "--cookie", "session-a", "--pod-id", "device-pod-71-freq"], {
|
||||
|
||||
Reference in New Issue
Block a user