mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-13 22:37:29 +00:00
* feat(agentstack): add @logicsrc/agentstack coordination module AgentStack is the LogicSRC module for portable agent, task, payment, and reputation coordination across Profullstack apps. Reference implementation of the `agentstack` capability in the Profullstack Shared AppKit OpenSpec. - packages/agentstack: DID helpers (did:coinpay:user/agent), DidTask model + lifecycle, AgentStack in-memory coordinator (agents, tasks, delegation, events), and a validated LogicSRC plugin definition. 9 vitest cases. - Wire @logicsrc/agentstack into the root build chain (after plugin-core). - docs/agentstack.md + mention in openspec-comparison.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * docs(agentstack): note dual-runtime support (Bun + Node.js + Workers + browser) Matches the revised Shared AppKit PRD's Runtime Compatibility Strategy. AgentStack is runtime-neutral (no Bun/Node-only APIs; time is injected). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2.4 KiB
2.4 KiB
@logicsrc/agentstack
AgentStack is the LogicSRC module for portable agent, task, payment, and reputation coordination across Profullstack microsaas apps (sh1pt, uGig, qaaas.dev, crawlproof, commandboard.run, coinpayportal, logicsrc, intr0s).
It is the reference implementation of the agentstack capability in the Profullstack
Shared AppKit OpenSpec (profullstack-web/openspec/specs/agentstack).
What it provides
- DID helpers for CoinPay-linked identities:
userDid,agentDid,makeDid,parseDid(did:coinpay:user:123,did:coinpay:agent:abc). DidTask— a portable task model with a defined status lifecycle (pending → queued → running → blocked → complete | failed | cancelled) that can bind to payment, escrow, and reputation events.AgentStack— an in-memory coordinator that registers agents, tracks tasks, records delegation grants, and emits coordination events. Storage backends can wrap the same API.agentStackPlugin— a LogicSRCPluginDefinition(validated against the plugin manifest schema) exposing AgentStack as a coordination plugin with routes, events, permissions, and a TUI panel.
Usage
import { AgentStack, userDid, agentDid } from "@logicsrc/agentstack";
const stack = new AgentStack();
const owner = userDid("123");
stack.registerAgent({
did: agentDid("abc"),
name: "Build Agent",
sourceApp: "commandboard.run",
supportedProtocols: ["logicsrc/1"]
});
const task = stack.createTask({ ownerDid: owner, sourceApp: "sh1pt.com", title: "Ship build" });
stack.assignTask(task.id, agentDid("abc"));
stack.updateTaskStatus(task.id, "running");
stack.updateTaskStatus(task.id, "complete", { reputationEventId: "rep_1" });
Cross-app identity
Each app keeps a local users.id and links it to a CoinPay DID, giving cross-app identity
without shared cookies or one global account database:
sh1pt.users.id -> did:coinpay:user:123
ugig.users.id -> did:coinpay:user:123
Runtime
Runtime-neutral by design — pure TypeScript with no Bun- or Node-only APIs (time is injected
via the AgentStack constructor). Runs on Bun, Node.js, Cloudflare Workers, and the
browser, matching the Profullstack dual-runtime standard.
Environment
AGENTSTACK_API_URL
AGENTSTACK_API_KEY
COINPAY_API_BASE_URL
Scripts
npm run build # tsc -> dist
npm test # vitest