@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
28 lines • 1.47 kB
JavaScript
import { DEFAULT_SLOT_BLOCK_MS, MAX_SLOT_BLOCK_MS } from "@earendil-works/pi-ai/auth/pool/failover";
import { NonemptyConfigValueSchema } from "@earendil-works/pi-ai/utils/config-reference";
import { Type } from "typebox";
/** Policy defaults shared with the pool engine so schema and runtime cannot drift. */
export const CREDENTIAL_POLICY_DEFAULTS = {
rotation: true,
affinity: true,
cooldownBaseMs: DEFAULT_SLOT_BLOCK_MS,
cooldownCapMs: MAX_SLOT_BLOCK_MS,
};
const CredentialSlotRefSchema = Type.Object({
env: Type.Optional(Type.String({ minLength: 1 })),
value: Type.Optional(NonemptyConfigValueSchema),
}, { additionalProperties: false });
/**
* Policy only: named slots REFERENCE env vars or command values; key material
* itself stays in auth.json or the environment, and unknown keys (for example
* a literal `apiKey`) are rejected outright.
*/
export const CredentialPolicySchema = Type.Object({
rotation: Type.Optional(Type.Boolean()),
affinity: Type.Optional(Type.Boolean()),
accountStrategy: Type.Optional(Type.Union([Type.Literal("cache-affine"), Type.Literal("fill-first"), Type.Literal("round-robin")])),
cooldownBaseMs: Type.Optional(Type.Number({ minimum: 0 })),
cooldownCapMs: Type.Optional(Type.Number({ minimum: 0 })),
slots: Type.Optional(Type.Record(Type.String({ minLength: 1 }), CredentialSlotRefSchema)),
}, { additionalProperties: false });
//# sourceMappingURL=credential-policy-schema.js.map