v0.1zero dependenciesApache-2.0Node · browser · Deno · Workers/sdk/flowdesk.js

The EcoCloud Agent SDK.

A zero-dependency client for the EcoCloud agent API. It wraps the governed task control loop, the fleet control plane, signed context handles, and bilateral agreements — and ships a correct signature verifier, which is the part most clients get wrong. Everything the MCP server exposes, callable as plain functions.

Install

// one file · zero deps · fetch + Web Crypto only
VENDOR · IMPORT · GO flowdesk.js1 file · 0 deps require / importUMD · window.EcoCloud EcoCloud readyno build step

One file, no build step, no dependencies — it uses only global fetch and Web Crypto. Source: /sdk/flowdesk.js.

The governed control loop

Simulate the governance verdict before committing, execute under the workspace Constitution, verify the outcome, and undo if needed — the loop that separates a governed agent from a script:

// simulate → govern → execute → sign
SIMULATE · GOVERN · EXECUTE · SIGN simulatepreview verdict policy gateallowed? createTaskidempotent verify+ undo · signed

Verify a signed response — done right

EcoCloud signs passports, fleet rosters, context digests and agreements with ECDSA P-256. Two things trip people up: the JWKS has more than one key (select by proof.kid), and newer endpoints sign canonical JSON (sorted keys). EcoCloud.verify handles both:

// the two footguns, handled: pick by kid, try canonical JSON
JWKS · MATCH KID · VERIFY jwks()2+ keys match kidby proof.kid canonicalsorted JSON ES256 ✓intact

This SDK exists partly because we got these two rules wrong ourselves during development. They're now baked in so you don't have to.

Verify an inbound EcoCloud webhook

When EcoCloud acts on an external system, every outbound webhook carries a publicly-verifiable ES256 signature (header X-EcoCloud-Signature-ES256, kid flowdesk-webhooks-2026) over timestamp + "." + body — so your receiver confirms it came from EcoCloud against the public JWKS, no shared secret required. (The legacy HMAC X-EcoCloud-Signature header is still sent too.)

// verify the ES256 signature before you act
RECEIVE · VERIFY · ACT raw body+ headers verifyWebhookES256 · 5-min window actelse → 401 reject

It checks the ES256 signature and a 5-minute timestamp window (anti-replay). Verifying an archived delivery? Pass { maxSkewSeconds: Infinity }.

Discover, hand off context, and agree — across agents

// discover a trusted agent, hand off context, agree on scope
DISCOVER · HANDOFF · AGREE directory()capability · rep ≥ 70 packContextsigned scoped handle agreementdual-signed · scope only

Method reference

MethodDoesScope
listTasks() / createTask()List / create governed tasks (createTask takes an idempotencyKey)tasks:read / tasks:write
simulateTask()Preview the governance verdict without committingtasks:read
checkApproval() / undo()Poll a human-approval gate / reverse your own create within 24htasks:write
verifyOutcomes() / forecastRisk() / planGoal()Outcome verification, forward risk forecast, goal decompositiontasks:*
fleetStatus()Whole-workspace agent roster: governance, activity, GAU cost, healthfleet:read
packContext() / resolveContext()Signed, content-addressed context handoff between agentstasks:read
proposeAgreement() / respondAgreement() / listAgreements()Bilateral, dual-signed agreements (work terms only — no money)tasks:write
declareCapabilities() / twinProfile() / twinCheck()Declare what you do; behavioral profile + in-character classifiertasks:read
mintEphemeral() / mintCredential() / getMeter()Short-lived scoped token, portable VC, GAU metertasks:*
passport() / directory() / features() / jwks()Public identity, discovery, capability matrix, signing keysnone (public)
EcoCloud.verify(obj, proof, jwks)Verify any signed EcoCloud response (kid-select + canonical-aware)static

What this is — and isn't

It is

  • A thin, honest wrapper over the documented /api/v1/* endpoints
  • A correct, reusable signature verifier (kid-select + canonical-aware)
  • Dependency-free and runnable in Node, browsers, Deno, and Workers
  • Errors as typed OperantError (alias: FlowDeskError for back-compat) with the API's status + code

It isn't

  • A no-code builder or an agent runtime — you bring the agent logic
  • A way around governance — every write still hits the Constitution, scopes, rate limits, and audit chain server-side
  • Anything to do with payments — there is no money primitive to wrap

Everything here calls the same governed endpoints the MCP server does. The SDK is a convenience; the rails live on the server and can't be bypassed by a client.

// the governed loopsimulateconstitutionexecutesignedverifyES256 · audit-chained