Files
openworker/deploy/resilience/contract.mjs
Rohit PrasadandDevika Verma d53e058eda Introduce OpenWorker Harness SDK (in beta), agent service cluster and relevant developer documentation (#844)
Allow developers to easily build AI apps without worrying about the harness part.
Bundles the Rust agent runtime as a SDK (Rust and TypeScript) for building desktop and web applications. Applications can manage a local harness or connect to an authenticated harness service on k8s with separately scaled workers and sandbox execution.

The implementation is primarily contained in harness/, with deployment tooling in deploy/, Markdown guides in docs/harness/guides/, and the static documentation site in docs-site/. It does not replace the existing Python harness or migrate OpenWorker Desktop.

Co-authored-by: Devika Verma <devikaverma11@gmail.com>
2026-11-06 09:45:20 -08:00

44 lines
1.4 KiB
JavaScript

import assert from "node:assert/strict";
export function dockerObjectAbsent(error) {
return /no such (object|container):/i.test(error.stderr ?? "");
}
// Destructive qualification accepts only an explicitly named, owned local fixture.
export function ownedLocalFixture(m, ns, confirmation) {
assert.match(m.context, /^kind-[a-z0-9-]+$/);
assert.match(m.namespace, /^ow-service-m4-resilience[a-z0-9]+$/);
assert.equal(ns.metadata.name, m.namespace);
assert.equal(ns.metadata.labels?.["openworker.io/qualification"], m.id);
assert.equal(
confirmation,
m.id,
"Pass the exact service ID to permit worker faults",
);
const u = new URL(m.url);
assert.equal(u.protocol, "https:");
assert(["localhost", "127.0.0.1", "[::1]"].includes(u.hostname));
assert.equal(
m.scripted,
true,
"Deterministic fixture only; never a customer service",
);
}
export function cursorTail(before, after) {
const last = before.at(-1)?.event_id ?? 0;
assert(
after.every((e) => e.event_id > last),
"Replay must start strictly after saved cursor",
);
assert(
after.every((e, i) => i === 0 || after[i - 1].event_id < e.event_id),
"Events must be ordered and unique",
);
}
export function noReplay(events, callId) {
assert.equal(
events.filter((e) => e.type === "tool_started" && e.data.call_id === callId)
.length,
1,
"An uncertain effect must not be dispatched twice",
);
}