import type { ApprovalDecision, ApprovalRequest, BlindSigner } from '../poppy-client/index.js';
import type { Actor } from '../types.js';
import type { PoppyCryptoConfig } from './crypto.js';
import type { PoppyConnectionStore } from './store.js';
/** What this app's agent may do at one Company. */
export interface PoppyCompanyPolicy {
    /** A name for the model and the pages. Default: the Company's own `organization.name`. */
    label?: string;
    /** Scopes the connect step asks for. Default: every scope the sign-in offers. */
    scopes?: string[];
    /**
     * Scopes that only READ — what `ask` narrows its token to, so a plain question can never make the
     * Company act (an action takes `request`, which the person confirms). Default: the scopes the Company hints change nothing (`auth.scope_hints`, `changes: none`).
     */
    readScopes?: string[];
}
/** A signing key of this app's agent identity: a private EC P-256 JWK (`kid` optional). */
export type PoppyAgentKey = Record<string, unknown>;
export interface PoppyConnectionsTexts {
    pageTitle: string;
    connectTitle: string;
    connectBody: string;
    direct: string;
    device: string;
    deviceBody: string;
    deviceCheck: string;
    mediatedTitle: string;
    mediatedSubmit: string;
    codeTitle: string;
    codeLabel: string;
    codeSubmit: string;
    connectedTitle: string;
    connectedBody: string;
    failedTitle: string;
    failedBody: string;
    expiredTitle: string;
    expiredBody: string;
    pendingBody: string;
    confirmConnectTitle: string;
    confirmConnectVerb: string;
    confirmConnectDetail: string;
    /**
     * What the conversation is continued with once the person connected (independent approvals:
     * a new turn on the thread, in the person's voice). `{company}`.
     */
    continueAfterConnect: string;
    confirmWriteTitle: string;
    confirmRequestTitle: string;
    confirmDisconnectTitle: string;
    confirmVerb: string;
    /** The approve card's title: it names the Company (Operations section 5). `{company}`. */
    confirmOperationTitle: string;
    confirmOperationVerb: string;
}
/** `{name}` placeholders: `{company}`, `{link}`, `{code}`, `{tool}`. */
export declare const DEFAULT_POPPY_CONNECTIONS_TEXTS: PoppyConnectionsTexts;
/**
 * `config/poppy_connections.ts` — this app's agent acting on OTHER Poppy Companies for its users.
 *
 * @experimental Tracks Personal Agent Protocol 1.0 (https://personalagentprotocol.org/docs/1.0/spec):
 * this API WILL change as the spec evolves — possibly in breaking ways, outside semver majors.
 */
export interface PoppyConnectionsConfig {
    /** This app's public origin (HTTPS). The identity lives at `{baseUrl}/{path}/agent.json`. */
    baseUrl: string;
    /** Where the identity, the connect pages and the callback are served. Default `'poppy-agent'`. */
    path?: string;
    identity: {
        /** `client_name` — what the Company shows its users on its consent screen. */
        name: string;
        logoUri?: string;
        /** Private EC P-256 JWKs (a JSON string works: an env var). The first signs; all are published. */
        keys: PoppyAgentKey[] | string;
        /**
         * Sign client assertions and delegations blindly with PS384 (spec 10.7) through your key
         * service. Its public key is published with the others; `keys` may then be `[]`.
         */
        blindSigner?: BlindSigner;
    };
    /**
     * Which of your agents this app is, when you run several for the same people (spec 5.1): each name
     * gets its own Agent ID at each Company. Leave it out when this is your only one.
     */
    agent?: string;
    /**
     * Optional Poppy extensions this agent uses with Companies that list them. Default: all on —
     * `operations` (approvals of exact terms), `links` and `disclosures` in the Company's replies.
     */
    extensions?: {
        operations?: boolean;
        links?: boolean;
        disclosures?: boolean;
    };
    /**
     * Approvals (the Operations extension). When a Company wants an action approved, `approve` decides
     * first: return `{ approver: 'agent' }` only when an instruction the person gave you covers these
     * exact terms (never on text from the Company), a `user` decision when you asked the person
     * yourself, or `'ask'`/`null` to have the model offer the approve card, where the person decides.
     */
    operations?: {
        approve?: (request: ApprovalRequest & {
            owner: string;
        }) => Promise<ApprovalDecision | 'ask' | null | undefined> | ApprovalDecision | 'ask' | null | undefined;
    };
    /**
     * The Companies this agent may talk to (`domain` or `domain:port`, as discovered). **Default:
     * none.** A list, a map to per-Company policy, or a predicate.
     */
    companies?: string[] | Record<string, PoppyCompanyPolicy> | ((domain: string) => boolean);
    /** Whose connection a turn uses. Default: `actor.tenantRef ?? actor.id`. */
    owner?: (actor: Actor) => string;
    /** `'lucid'` (default), `'memory'`, or a store. */
    store?: 'lucid' | 'memory' | PoppyConnectionStore;
    connection?: string;
    /**
     * The database schema (a Postgres schema, a MySQL database) the `'lucid'` store's tables live in —
     * every statement names it, never `SET search_path`. Default: the top-level `schema` of
     * `config/agent.ts`, else none (the connection's current schema). Refused on SQLite.
     */
    schema?: string;
    autoCreateTables?: boolean;
    /** Seals tokens and keys at rest. Default: the app key. */
    secret?: string;
    /**
     * Key rotation for what is sealed at rest. Default: one key `app` from `secret`. Rotate with
     * `keys: [{ id: '2026-11', secret: env.get('POPPY_KEY_2026_11') }, { id: 'app', secret: env.get('APP_KEY').release() }]`,
     * `active: '2026-11'`, then `node ace agent:crypto:reseal`.
     */
    crypto?: PoppyCryptoConfig;
    /**
     * DEVELOPMENT ONLY, not spec-compliant: accept `http://` Companies and serve the identity over
     * http (a local app). Refused when `NODE_ENV=production`.
     */
    insecureDev?: boolean;
    /**
     * Tool names' prefix (default `'poppy_'`), the roles they require, how `connect` works
     * (`'action'` card that resumes, or `'link'`), and whether the write tools are registered.
     * `register: false` registers none (an app with its own per-turn registry calls
     * `registerPoppyConnectionTools` itself).
     */
    tools?: {
        prefix?: string;
        roles?: string[];
        ability?: string;
        connect?: 'action' | 'link';
        writes?: boolean;
        register?: boolean;
        /**
         * Company tools that confirm in two steps (called first without `confirm` they only answer a
         * preview and a `confirmToken`): the write tool shows that preview on its card and, once the
         * person confirms, commits with the token. Detected by the tool's input schema having both
         * fields. `false` turns it off. Default `{ confirm: 'confirm', token: 'confirmToken' }`.
         */
        twoStep?: TwoStepConvention | false;
    };
    /** How long a connect link works, in seconds. Default 900. */
    connectTtlSeconds?: number;
    /** How long `ask`/`request` wait for the Company's reply. Default 90 000 ms. */
    replyTimeoutMs?: number;
    texts?: Partial<PoppyConnectionsTexts>;
    /**
     * Routes for the app's own UI: `GET {path}/api/connections`, `DELETE {path}/api/connections/:domain`,
     * behind the app's session. `actor` says who is asking (null → 401).
     */
    api?: {
        actor: (ctx: import('@adonisjs/core/http').HttpContext) => Actor | null | Promise<Actor | null>;
    };
    /** `fetch` for every request to Companies (tests). */
    fetch?: typeof fetch;
}
/** Field names of a Company's two-step confirmation convention (see `tools.twoStep`). */
export interface TwoStepConvention {
    confirm: string;
    token: string;
    /** Preview fields read for the card, first found wins. Default `['summary', 'resumo', 'message']`. */
    summary?: string[];
}
export declare function definePoppyConnectionsConfig(config: PoppyConnectionsConfig): PoppyConnectionsConfig;
/** `https://Acme.com/` → `acme.com`; `localhost:3333` stays. */
export declare function normalizeDomain(value: string): string;
//# sourceMappingURL=config.d.ts.map