This repository has been archived on 2026-06-01. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nerve/packages/khala/src/workflows/ping-pong.ts
T
tuanzi 45fdf3ff9f fix(khala): address review #132 — reuse nerve-core Result, RETURNING for appendMessage, configurable timeout
- Remove duplicate result.ts, import Result/ok/err from @uncaged/nerve-core
- appendMessage uses INSERT...RETURNING instead of INSERT+SELECT
- CloudRole.timeoutSeconds: per-role timeout (defaults to 300s)
- TODO comments for rate limiting and capacity sensing
2026-04-25 04:53:07 +00:00

15 lines
485 B
TypeScript

import { type CloudWorkflowDef, registerWorkflow } from "../workflows.js";
const pingPong: CloudWorkflowDef = {
name: "ping-pong",
roles: {
pinger: { prompt: "Send the literal word ping", timeoutSeconds: null },
ponger: { prompt: "Send the literal word pong", timeoutSeconds: null },
},
moderator: `$count(steps) >= 6 ? { "role": "__end__" } : $count(steps) % 2 = 0 ? { "role": "pinger" } : { "role": "ponger" }`,
};
registerWorkflow(pingPong);
export { pingPong };