/** * backendSession — the ONE place the "backend-calling skill" contract lives. * * A skill whose CHILD-executed code calls Zibby's own backend * (resolveIntegrationToken / getAccountApiUrl — the cloud auth path, and the * self-host per-turn-JWT path) declares it ONCE with `callsBackend: true` on * the skill object. This module then GUARANTEES the spawned MCP child's env * carries the backend-session keys — authors no longer hand-maintain the same * allowlist in both envKeys and resolve() (the two-places drift that bit * github/gitlab 2026-07 and lark/lark-docs 2026-08; see * src/__tests__/backend-session-env-contract.test.ts). * * The marker is ALSO consumed downstream: the self-host Copilot's turn-local * delivery (backend/copilot-runtime chat-ops-bot/lib/turn-local-skills.js) * reflects `callsBackend` off the registry to decide which children get the * per-turn short-lived JWT instead of a stored PAT. * * Wiring: src/index.ts applies withBackendSessionEnv() to every skill at * registration, so the REGISTERED skill (what the engine resolves) always * honors the marker. Existing skills keep their explicit resolve() allowlists * — this wrapper only ADDS missing session keys (a key the resolve() already * set always wins), so behavior for the fixed skills is byte-identical. */ /** The session keys a backend-calling MCP child needs (the contract-test set). */ export declare const BACKEND_SESSION_KEYS: readonly ["PROJECT_API_TOKEN", "ZIBBY_ACCOUNT_API_URL", "ZIBBY_ENV"]; /** * Enforce the callsBackend contract on a skill object (idempotent): * - envKeys gains any missing session key (the engine's command-style * fallback copies ONLY envKeys — tool-resolver.ts); * - resolve() is wrapped so a spawned child's env (a spec with `command`) * gains any session key present in process.env that the original resolve() * omitted. Keys the resolve() DID set always win — no override, no drop. * Skills without callsBackend (or without resolve/command) pass through * untouched. Mutates in place when possible; a frozen/sealed skill is wrapped * as a shallow CLONE instead — always consume the RETURN value (index.ts * registers the return, so the registry copy is the enforced one either way). */ export declare function withBackendSessionEnv>(skill: T): T;