@fabric-harness/client
v2.2.2
Published
Typed HTTP client for Fabric Harness servers: send durable agent submissions, observe conversations by offset, wait for settlements, invoke jobs.
Maintainers
Readme
@fabric-harness/client
Typed HTTP client for Fabric Harness servers.
Agent interactions ride the durable submission lifecycle: send is fire-and-forget (202 + submission id + offset-addressed stream), wait polls the submission until it settles, history/observe read the conversation stream by offset (catch-up + live tail), abort records a durable abort, and prompt is the synchronous convenience. Finite jobs support synchronous results and durable run receipts.
npm install @fabric-harness/clientimport { createFabricClient } from '@fabric-harness/client';
const client = createFabricClient({
baseUrl: 'http://localhost:4317',
headers: { authorization: `Bearer ${process.env.FABRIC_HARNESS_TOKEN}` },
});
// Fire-and-forget: durable admission, observe at your own pace.
const sent = await client.agents.send({ agent: 'support', id: 'user-42', message: 'hello' });
const settled = await client.agents.wait({ agent: 'support', id: 'user-42', submissionId: sent.submissionId });
// Live tail the conversation (catch-up from offset 0, then follow).
for await (const record of client.agents.observe({ agent: 'support', id: 'user-42' })) {
if (record.kind === 'entry') console.log(record.entry.type);
}
// Synchronous convenience, and finite jobs.
const { result } = await client.agents.prompt({ agent: 'support', id: 'user-42', message: 'status?' });
const jobResult = await client.jobs.invoke('daily-report', { day: '2026-07-08' });
// Durable finite run: admit, inspect/observe, and abort without a long HTTP request.
const run = await client.jobs.invoke(
'daily-report',
{ day: '2026-07-08' },
{ wait: false, idempotencyKey: 'daily-report:2026-07-08' },
);
const status = await client.runs.get(run.runId);
for await (const event of client.runs.observe(run.runId)) console.log(event);
await client.runs.abort(run.runId);
// Durable abort for everything unsettled on the instance session.
await client.agents.abort({ agent: 'support', id: 'user-42' });Apache-2.0
