@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
44 lines • 2.16 kB
TypeScript
/**
* The custody sidecar `<agentDir>/custody.json` (custody design 4.1, row CK5).
*
* It lives beside models.json, never inside it, so fused parsers and older CLIs never see a custody
* field. Only the device service writes it (temp file + rename); the fused CLI never reads it.
* A read is tri-state so a caller can tell "not enabled" (absent) from "broken" (invalid).
*/
import { type Static, Type } from "typebox";
declare const ProviderCustodySchema: Type.TObject<{
custody: Type.TOptional<Type.TUnion<[Type.TLiteral<"sealed">, Type.TLiteral<"device">]>>;
apiKeyTtlSeconds: Type.TOptional<Type.TInteger>;
headersTtlSeconds: Type.TOptional<Type.TInteger>;
sealedCwdHash: Type.TOptional<Type.TString>;
secretUrlParts: Type.TOptional<Type.TArray<Type.TString>>;
}>;
declare const CustodySidecarSchema: Type.TObject<{
v: Type.TLiteral<1>;
providers: Type.TRecord<"^.*$", Type.TObject<{
custody: Type.TOptional<Type.TUnion<[Type.TLiteral<"sealed">, Type.TLiteral<"device">]>>;
apiKeyTtlSeconds: Type.TOptional<Type.TInteger>;
headersTtlSeconds: Type.TOptional<Type.TInteger>;
sealedCwdHash: Type.TOptional<Type.TString>;
secretUrlParts: Type.TOptional<Type.TArray<Type.TString>>;
}>>;
consent: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
withdrawal: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
}>;
export type CustodySidecar = Static<typeof CustodySidecarSchema>;
export type ProviderCustody = Static<typeof ProviderCustodySchema>;
export type CustodySidecarRead = {
readonly state: "absent";
} | {
readonly state: "ok";
readonly sidecar: CustodySidecar;
} | {
readonly state: "invalid";
readonly reason: string;
};
export declare function custodySidecarPath(agentDir: string): string;
export declare function readCustodySidecar(path: string): Promise<CustodySidecarRead>;
/** Writes the whole sidecar atomically: a 0600 temp file in the same directory, fsync, rename, fsync dir. */
export declare function writeCustodySidecar(path: string, sidecar: CustodySidecar): Promise<void>;
export {};
//# sourceMappingURL=custody-sidecar.d.ts.map