@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
77 lines • 3.73 kB
TypeScript
import type { ActionProposalDecision, ActionProposalMutationResult } from './spi/action-proposal-store.js';
export interface TextActionProposalCandidate {
id: string;
decision: ActionProposalDecision;
}
export type TextActionProposalResolution = {
status: 'unmatched';
} | {
status: 'ambiguous';
proposalIds: string[];
} | {
status: 'decision';
proposalId: string;
decision: 'approved' | 'rejected';
remember: boolean;
};
/**
* Recognizes complete, explicit decision messages. This grants no authority: callers must
* resolve the authenticated actor and use the normal scoped decision service with via=text.
* Never feed model output here or consume an unmatched message as an approval.
*/
export declare function resolveTextActionProposalDecision(text: string, proposals: readonly TextActionProposalCandidate[], vocabulary?: TextActionProposalVocabulary): TextActionProposalResolution;
export type TextActionProposalCommand = {
status: 'unmatched';
} | {
status: 'command';
decision: 'approved' | 'rejected';
remember: boolean;
proposalId?: string;
};
/**
* The words a whole chat message must consist of to decide a proposal by text. Matched
* case-insensitively, as the complete message (an optional trailing `.`/`!`, an optional `#ID`).
*/
export interface TextActionProposalVocabulary {
/** Approve, e.g. `sim`, `yes`. */
approve: readonly string[];
/** Reject, e.g. `não`, `no`. */
reject: readonly string[];
/** The phrase after an approve word that also approves later calls of the tool in this thread. */
remember: readonly string[];
/**
* The language these words are in (a BCP 47 tag, e.g. `pt-BR`). Surfaces that speak on their own
* (text channels) pick their default texts by it, so the words and the texts agree.
*/
language?: string;
}
/** English. Portuguese ships as {@link ptBrActionProposalText}; any other language via config. */
export declare const DEFAULT_TEXT_ACTION_PROPOSAL_VOCABULARY: TextActionProposalVocabulary;
/** What the agent answers to a text decision. Every field has an English default. */
export interface TextActionProposalReplies {
approved: string;
rejected: string;
expired: string;
/** The proposal could not change (already decided by someone else, superseded, …). */
unchanged: string;
/** More than one pending proposal could be meant: ask for the `#ID`. */
ambiguous(proposalIds: readonly string[]): string;
/** Too many pending proposals to pick one without an explicit `#ID`. */
tooMany: string;
}
export declare const DEFAULT_TEXT_ACTION_PROPOSAL_REPLIES: TextActionProposalReplies;
/** `config/agent.ts`'s `actionProposalText`: either part replaces the default it names. */
export interface TextActionProposalConfig {
vocabulary?: Partial<TextActionProposalVocabulary>;
replies?: Partial<TextActionProposalReplies>;
}
/** The reply to a decision the store answered with `result`. */
export declare function textActionProposalReply(result: ActionProposalMutationResult, decision: 'approved' | 'rejected', replies?: TextActionProposalReplies): string;
/** Parse exact consent syntax only. Authentication and target lookup remain the caller's responsibility. */
export declare function parseTextActionProposalCommand(text: string, vocabulary?: TextActionProposalVocabulary): TextActionProposalCommand;
/**
* Brazilian Portuguese text decisions — `config/agent.ts`: `actionProposalText: ptBrActionProposalText`.
* Commands in Portuguese (English ones still work), replies in Portuguese.
*/
export declare const ptBrActionProposalText: Required<TextActionProposalConfig>;
//# sourceMappingURL=action-proposal-text.d.ts.map