feat(agent): improve investigation contracts and runtime readiness
Generic Container CI/CD / test-build-publish (push) Successful in 1m53s
Agent CI/CD / build-test-publish-and-deploy (push) Successful in 1m53s

This commit is contained in:
2026-11-07 19:43:57 +08:00
parent c7b750b099
commit b8f7edb3ee
29 changed files with 1465 additions and 119 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ function runtime(state: "missing" | "enqueued" | "delivered", active = false) {
const adapter = Object.assign(Object.create(OpencodeRuntimeAdapter.prototype), {
ensureClient: async () => ({ session: { active: async () => active ? { s: {} } : {}, interrupt: async (input: unknown) => { calls.push(input); } } }),
agentMessageState: async () => state,
ensureSessionToolsReady: async () => undefined,
prompt: async (...args: unknown[]) => { calls.push(args); },
}) as OpencodeRuntimeAdapter;
return { adapter, calls };
@@ -13,7 +14,7 @@ function runtime(state: "missing" | "enqueued" | "delivered", active = false) {
test("host reply continuation injects fixed ID only when absent; queued and consumed IDs never reinject", async () => {
const missing = runtime("missing");
expect(await missing.adapter.continueInteraction("s", "msg_fixed", "answer")).toBe("started");
expect(missing.calls).toEqual([["s", "answer", undefined, "msg_fixed"]]);
expect(missing.calls).toEqual([["s", "answer", undefined, "msg_fixed", undefined]]);
const busy = runtime("missing", true);
await expect(busy.adapter.continueInteraction("s", "msg_fixed", "answer")).rejects.toThrow("still active");
expect(busy.calls).toEqual([]);