Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(agenc): label task states with the on-chain enum instead of a shifted map

nirholas1972f012e084
diff --git a/api/agenc/[action].js b/api/agenc/[action].js
index 39dcfe60a..f0b6efc4f 100644
--- a/api/agenc/[action].js
+++ b/api/agenc/[action].js
@@ -91,8 +91,14 @@ function serialize(value) {
return value;
}
-function taskStateLabel(state) {
- const map = { 0: 'Open', 1: 'Claimed', 2: 'Completed', 3: 'Cancelled', 4: 'Disputed', 5: 'Expired' };
+// AgenC's on-chain TaskState enum, verbatim (@tetsuo-ai/sdk `TaskState` /
+// `formatTaskState`). This map was previously shifted by one past `Open`, which
+// reported a Completed task as "Cancelled" and a Cancelled one as "Disputed": the
+// worst kind of wrong, because it reads as a definite (and alarming) status rather
+// than an error. There is no 'Expired' state on-chain; a lapsed deadline leaves the
+// task Open until its creator cancels it.
+export function taskStateLabel(state) {
+ const map = { 0: 'Open', 1: 'In Progress', 2: 'Pending Validation', 3: 'Completed', 4: 'Cancelled', 5: 'Disputed' };
if (typeof state === 'number') return map[state] ?? `Unknown(${state})`;
if (state && typeof state === 'object') {
const key = Object.keys(state)[0];