@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
41 lines • 2.02 kB
TypeScript
import { BaseWorkflow, type WorkflowCtx, type WorkflowEngine } from '@adonis-agora/durable';
import type { AgentRunInput } from '../../types.js';
import type { OpenCodeTurns } from '../turns.js';
export declare const OPENCODE_RUN_WORKFLOW = "agora.agent.opencode.run";
/** The token a person's answer to `toolCallId` is signalled under — the library's own convention. */
export declare function decisionToken(runId: string, toolCallId: string): string;
/**
* A suspend / continue-as-new the runtime throws THROUGH the body — control flow, not a failure.
* Recognised by name, so a second copy of `@adonis-agora/durable` (another class identity) still is.
*/
export declare function isControlFlowSignal(error: unknown): boolean;
/**
* An OpenCode turn as a durable workflow:
*
* begin → prompt → observe:0 → [ wait for a person (signal `tool:<run>:<call>`) → reply:n → observe:n+1 ]* → finish
*
* Every step is checkpointed. A turn parked on a person is a suspended run with a signal waiter: an
* app restart loses nothing, and the decision resumes it on whichever process takes it — replaying
* the steps from their checkpoints and replying to OpenCode from there (`OpenCodeTurns` rebuilds the
* live turn, and re-prompts a fresh session when OpenCode itself restarted meanwhile). A process
* that dies while OpenCode works re-runs that `observe` step, which catches up on what OpenCode
* asked while nobody listened.
*
* Built by the engine's factory with the turn steps (see `registerOpenCodeWorkflow`), not by the
* container.
*/
export declare class OpenCodeRunWorkflow extends BaseWorkflow {
private readonly turns;
private readonly engine?;
static workflow: {
name: string;
version: string;
origin: string;
};
constructor(turns: OpenCodeTurns, engine?: WorkflowEngine | undefined);
run(ctx: WorkflowCtx, input: AgentRunInput): Promise<{
outcome: string;
}>;
private cancelled;
}
//# sourceMappingURL=workflow.d.ts.map