/**
 * Generated by tsnapi — public API snapshot of `devframe`
 */
// #region Interfaces
export interface AgentHandle {
  unregister: () => void;
}
export interface AgentManifest {
  tools: readonly AgentTool[];
  resources: readonly AgentResource[];
}
export interface AgentResource {
  id: string;
  uri: string;
  name: string;
  description?: string;
  mimeType?: string;
}
export interface AgentResourceContent {
  text?: string;
  json?: unknown;
  mimeType?: string;
}
export interface AgentResourceInput {
  id: string;
  name: string;
  description?: string;
  mimeType?: string;
  uri?: string;
  read: () => Promise<AgentResourceContent> | AgentResourceContent;
}
export interface AgentTool {
  id: string;
  kind: 'rpc' | 'tool';
  title: string;
  description: string;
  safety: 'read' | 'action' | 'destructive';
  tags?: readonly string[];
  rpcName?: string;
  args?: readonly StandardSchemaV1[];
  inputSchema?: unknown;
  outputSchema?: unknown;
  examples?: readonly {
    args: unknown[];
    description?: string;
  }[];
}
export interface AgentToolInput {
  id: string;
  title?: string;
  description: string;
  safety?: 'read' | 'action' | 'destructive';
  tags?: readonly string[];
  args?: readonly StandardSchemaV1[];
  inputSchema?: unknown;
  outputSchema?: unknown;
  examples?: readonly {
    args: unknown[];
    description?: string;
  }[];
  handler: (_: any) => unknown | Promise<unknown>;
}
export interface AgentToolProviderHandle extends AgentHandle {
  notifyChanged: () => void;
}
export interface ConnectionMeta {
  backend: 'websocket' | 'static';
  websocket?: number | string | ConnectionMetaWebsocket;
  mcp?: {
    path: string;
    port?: number;
  };
  jsonSerializableMethods?: string[];
  baseUrl?: string;
  authToken?: string;
  viewerOriginToken?: string;
}
export interface ConnectionMetaWebsocket {
  path?: string;
  port?: number;
  host?: string;
}
export interface DevframeAgentHost {
  readonly events: EventEmitter<DevframeAgentHostEvents>;
  registerTool: (_: AgentToolInput) => AgentHandle;
  unregisterTool: (_: string) => boolean;
  registerToolProvider: (_: AgentToolProvider) => AgentToolProviderHandle;
  registerResource: (_: AgentResourceInput) => AgentHandle;
  unregisterResource: (_: string) => boolean;
  list: () => AgentManifest;
  invoke: (_: string, _: unknown) => Promise<unknown>;
  read: (_: string) => Promise<AgentResourceContent>;
  getTool: (_: string) => AgentTool | undefined;
  getResource: (_: string) => AgentResource | undefined;
}
export interface DevframeAgentHostEvents {
  'agent:tool:registered': (_: AgentTool) => void;
  'agent:tool:unregistered': (_: string) => void;
  'agent:resource:registered': (_: AgentResource) => void;
  'agent:resource:unregistered': (_: string) => void;
  'agent:manifest:changed': () => void;
}
export interface DevframeBrowserContext {
  rpc: unknown;
}
export interface DevframeCapabilities {
  rpc?: boolean;
  views?: boolean;
}
export interface DevframeCliOptions {
  command?: string;
  port?: number;
  portRange?: [number, number];
  random?: boolean;
  host?: string;
  open?: boolean | string;
  auth?: boolean | DevframeAuthHandler;
  mcp?: boolean | McpRouteOptions;
  distDir?: string;
  ws?: DevframeWsOptions;
  configure?: (_: CAC) => void;
  flags?: CliFlagsSchema;
}
export interface DevframeDefineDiagnosticsOptions<Codes extends Record<string, DiagnosticDefinition>> {
  docsBase?: string | ((_: keyof Codes) => string | undefined);
  codes: Codes;
  reporters?: ReadonlyArray<(d: Diagnostic, o?: any) => void>;
}
export interface DevframeDefinition {
  id: string;
  name: string;
  version: string;
  packageName: string;
  homepage: string;
  description: string;
  icon?: string | {
    light: string;
    dark: string;
  };
  dock?: DevframeDockDefaults;
  basePath?: string;
  duplicationStrategy?: DevframeDuplicationStrategy;
  capabilities?: {
    dev?: boolean | Record<string, boolean>;
    build?: boolean | Record<string, boolean>;
    spa?: boolean | Record<string, boolean>;
  };
  setup: (_: DevframeNodeContext, _?: DevframeSetupInfo) => void | Promise<void>;
  setupBrowser?: (_: DevframeBrowserContext) => void | Promise<void>;
  cli?: DevframeCliOptions;
  spa?: DevframeSpaOptions;
}
export interface DevframeDiagnosticsHost {
  readonly logger: DevframeDiagnosticsLogger;
  register: (_: Record<string, unknown>) => void;
  defineDiagnostics: <const Codes extends Record<string, DiagnosticDefinition>>(_: DevframeDefineDiagnosticsOptions<Codes>) => ReturnType<typeof defineDiagnostics<Codes, any>>;
}
export interface DevframeDockDefaults {
  title?: string;
  icon?: string | {
    light: string;
    dark: string;
  };
  defaultOrder?: number;
  category?: string;
  when?: string;
  visibility?: string;
  badge?: string;
  groupId?: string;
}
export interface DevframeHost {
  mountStatic: (_: string, _: string) => void | Promise<void>;
  mountConnectionMeta?: (_: string) => void | Promise<void>;
  resolveOrigin: () => string;
  getStorageDir: (_: DevframeStorageScope) => string;
}
export interface DevframeNodeContext {
  readonly workspaceRoot: string;
  readonly cwd: string;
  readonly mode: 'dev' | 'build';
  host: DevframeHost;
  rpc: RpcFunctionsHost;
  views: DevframeViewHost;
  diagnostics: DevframeDiagnosticsHost;
  agent: DevframeAgentHost;
  services: DevframeServicesHost;
  scope: {
    <NS extends string>(_: NS): DevframeScopedNodeContext<NS, SettingsForNamespace<NS>>;
    (_?: null | ''): DevframeNodeContext;
  };
}
export interface DevframeNodeRpcSession {
  meta: DevframeNodeRpcSessionMeta;
  rpc: BirpcReturn<DevframeRpcClientFunctions, DevframeRpcServerFunctions, false>;
}
export interface DevframeNodeRpcSessionMeta {
  id: number;
  peer?: Peer;
  clientAuthToken?: string;
  isTrusted?: boolean;
  subscribedStates: Set<string>;
  subscribedStreams?: Set<string>;
  uploadingStreams?: Set<string>;
}
export interface DevframeRpcClientFunctions {
  'devframe:auth:revoked': () => Promise<void>;
  'devframe:streaming:chunk': (_: string, _: string, _: number, _: any) => Promise<void>;
  'devframe:streaming:end': (_: string, _: string, _?: {
    name: string;
    message: string;
  }) => Promise<void>;
  'devframe:streaming:upload-cancel': (_: string, _: string) => Promise<void>;
  'devframe:rpc:client-state:updated': (_: string, _: any, _: string) => Promise<void>;
  'devframe:rpc:client-state:patch': (_: string, _: any[], _: string) => Promise<void>;
}
export interface DevframeRpcServerFunctions {
  'anonymous:devframe:auth': (_: {
    authToken: string;
    ua: string;
    origin: string;
  }) => Promise<{
    isTrusted: boolean;
  }>;
  'anonymous:devframe:auth:exchange': (_: {
    code: string;
    ua: string;
    origin: string;
  }) => Promise<{
    authToken: string | null;
  }>;
  'devframe:auth:revoke': () => Promise<void>;
  'devframe:rpc:server-state:subscribe': (_: string) => Promise<void>;
  'devframe:rpc:server-state:get': (_: string) => Promise<any>;
  'devframe:rpc:server-state:set': (_: string, _: any, _: string) => Promise<void>;
  'devframe:rpc:server-state:patch': (_: string, _: any[], _: string) => Promise<void>;
  'devframe:streaming:subscribe': (_: string, _: string, _?: {
    afterSeq?: number;
  }) => Promise<void>;
  'devframe:streaming:unsubscribe': (_: string, _: string) => Promise<void>;
  'devframe:streaming:cancel': (_: string, _: string) => Promise<void>;
  'devframe:streaming:upload-chunk': (_: string, _: string, _: number, _: any) => Promise<void>;
  'devframe:streaming:upload-end': (_: string, _: string, _?: {
    name: string;
    message: string;
  }) => Promise<void>;
}
export interface DevframeRpcSharedStates {}
export interface DevframeScopedNodeContext<NS extends string = string, Settings extends Record<string, any> = Record<string, any>> {
  readonly namespace: NS;
  readonly base: DevframeNodeContext;
  readonly workspaceRoot: string;
  readonly cwd: string;
  readonly mode: 'dev' | 'build';
  host: DevframeHost;
  rpc: DevframeScopedNodeRpc<NS>;
  settings: DevframeSettings<Settings>;
  views: DevframeViewHost;
  diagnostics: DevframeDiagnosticsHost;
  agent: DevframeAgentHost;
  scope: DevframeNodeContext['scope'];
}
export interface DevframeScopedNodeRpc<NS extends string = string> {
  readonly namespace: NS;
  register: (_: RpcFunctionDefinition<string, any, any, any, any, any, DevframeNodeContext>, _?: boolean) => void;
  update: (_: RpcFunctionDefinition<string, any, any, any, any, any, DevframeNodeContext>, _?: boolean) => void;
  call: {
    <T extends keyof ScopedServerFunctions<NS> & string>(_: T, ..._: Parameters<ScopedRpcFn<DevframeRpcServerFunctions, NS, T>>): Promise<Awaited<ReturnType<ScopedRpcFn<DevframeRpcServerFunctions, NS, T>>>>;
    <T extends keyof DevframeRpcServerFunctions & string>(_: T, ..._: Parameters<Extract<DevframeRpcServerFunctions[T], AnyRpcFn>>): Promise<Awaited<ReturnType<Extract<DevframeRpcServerFunctions[T], AnyRpcFn>>>>;
    (_: string, ..._: any[]): Promise<any>;
  };
  broadcast: {
    <T extends keyof ScopedClientFunctions<NS> & string>(_: ScopedBroadcastOptions<T, Parameters<ScopedRpcFn<DevframeRpcClientFunctions, NS, T>>>): Promise<void>;
    (_: ScopedBroadcastOptions<string, any[]>): Promise<void>;
  };
  sharedState: {
    <T extends keyof ScopedSharedStates<NS> & string>(_: T, _?: RpcSharedStateGetOptions<ScopedSharedStates<NS>[T]>): Promise<SharedState<ScopedSharedStates<NS>[T]>>;
    <T extends Record<string, any> = Record<string, any>>(_: string, _?: RpcSharedStateGetOptions<T>): Promise<SharedState<T>>;
  };
  streaming: DevframeScopedStreamingHost;
  getCurrentRpcSession: () => DevframeNodeRpcSession | undefined;
}
export interface DevframeScopedStreamingHost {
  create: <T = unknown>(_: string, _?: RpcStreamingChannelOptions) => RpcStreamingChannel<T>;
}
export interface DevframeServicesHost {
  provide: <ID extends DevframeServiceId>(_: ID, _: DevframeServiceOf<ID>) => () => void;
  get: <ID extends DevframeServiceId>(_: ID) => DevframeServiceOf<ID> | undefined;
  has: (_: DevframeServiceId) => boolean;
  whenAvailable: <ID extends DevframeServiceId>(_: ID, _: (_: DevframeServiceOf<ID>) => void) => () => void;
  keys: () => string[];
}
export interface DevframeServicesRegistry {}
export interface DevframeSettings<T extends Record<string, any> = Record<string, any>> {
  global: DevframeSettingsStore<T>;
  project: DevframeSettingsStore<T>;
}
export interface DevframeSettingsRegistry {}
export interface DevframeSettingsStore<T extends Record<string, any> = Record<string, any>> {
  get: <K extends keyof T>(_: K) => Promise<T[K] | undefined>;
  set: <K extends keyof T>(_: K, _: T[K]) => Promise<void>;
  delete: <K extends keyof T>(_: K) => Promise<void>;
  all: () => Promise<Readonly<T>>;
  onChange: (_: (_: Readonly<T>) => void) => Promise<() => void>;
}
export interface DevframeSetupInfo {
  flags?: Record<string, unknown>;
}
export interface DevframeSpaOptions {
  base?: string;
  loader?: 'query' | 'upload' | 'none';
}
export interface DevframeViewHost {
  buildStaticDirs: {
    baseUrl: string;
    distDir: string;
  }[];
  hostStatic: (_: string, _: string) => void;
}
export interface DevframeWsOptions {
  route?: string;
  port?: number;
  url?: string;
}
export interface EventEmitter<Events extends EventsMap> {
  emit: <K extends keyof Events>(_: K, ..._: Parameters<Events[K]>) => void;
  emitOnce: <K extends keyof Events>(_: K, ..._: Parameters<Events[K]>) => void;
  _listeners: Partial<{ [E in keyof Events]: Events[E][]; }>;
  on: <K extends keyof Events>(_: K, _: Events[K]) => EventUnsubscribe;
  once: <K extends keyof Events>(_: K, _: Events[K]) => EventUnsubscribe;
}
export interface EventsMap {
  [event: string]: any;
}
export interface EventUnsubscribe {
  (): void;
}
export interface McpRouteOptions {
  path?: string;
  allowedOrigins?: readonly string[] | false;
}
export interface RpcBroadcastOptions<METHOD, Args extends any[]> {
  method: METHOD;
  args: Args;
  optional?: boolean;
  event?: boolean;
  filter?: (_: BirpcReturn<DevframeRpcClientFunctions, DevframeRpcServerFunctions, false>) => boolean | void;
}
export interface RpcFunctionAgentOptions {
  description: string;
  title?: string;
  safety?: 'read' | 'action' | 'destructive';
  tags?: readonly string[];
  examples?: readonly {
    args: unknown[];
    description?: string;
  }[];
}
export interface RpcSharedStateGetOptions<T> {
  sharedState?: SharedState<T>;
  initialValue?: T;
}
export interface RpcSharedStateHost {
  get: <T extends object = any>(_: string, _?: RpcSharedStateGetOptions<T>) => Promise<SharedState<T>>;
  keys: () => string[];
  onKeyAdded: (_: (_: string) => void) => () => void;
  delete: (_: string) => boolean;
}
export interface RpcStreamingChannel<T = unknown> {
  readonly name: string;
  start: (_?: {
    id?: string;
  }) => StreamSink<T>;
  pipeFrom: (_: ReadableStream<T>, _?: {
    id?: string;
  }) => Promise<StreamSink<T>>;
  get: (_: string) => StreamSink<T> | undefined;
  ids: () => string[];
  openInbound: (_?: {
    id?: string;
  }) => StreamReader<T>;
}
export interface RpcStreamingChannelOptions {
  replayWindow?: number;
  closedStreamRetention?: number;
}
export interface RpcStreamingHost {
  create: <T = unknown>(_: string, _?: RpcStreamingChannelOptions) => RpcStreamingChannel<T>;
  _onSessionDisconnected: (_: DevframeNodeRpcSessionMeta) => void;
}
export interface ScopedBroadcastOptions<METHOD, Args extends any[]> {
  method: METHOD;
  args: Args;
  optional?: boolean;
  event?: boolean;
}
// #endregion

// #region Types
export type AgentToolProvider = () => readonly AgentToolInput[];
export type DevframeDeploymentKind = 'standalone' | 'hosted';
export type DevframeDiagnosticsDefinition = ReturnType<typeof defineDiagnostics<any, any>>;
export type DevframeDiagnosticsLogger = Record<string, any>;
export type DevframeDuplicationStrategy = 'warn' | 'silent' | 'throw' | 'duplicate';
export type DevframeRuntime = 'cli' | 'build' | 'spa' | 'vite' | 'embedded';
export type DevframeServiceId = keyof DevframeServicesRegistry | (string & {});
export type DevframeServiceOf<ID> = ID extends keyof DevframeServicesRegistry ? DevframeServicesRegistry[ID] : unknown;
export type DevframeStorageScope = 'workspace' | 'project' | 'global';
export type EntriesToObject<T extends readonly [string, any][]> = { [K in T[number] as K[0]]: K[1]; };
export type PartialWithoutId<T extends {
  id: string;
}> = Partial<Omit<T, 'id'>> & {
  id: string;
};
export type RpcFunctionsHost = RpcFunctionsCollectorBase<DevframeRpcServerFunctions, DevframeNodeContext> & {
  invokeLocal: <T extends keyof DevframeRpcServerFunctions, Args extends Parameters<DevframeRpcServerFunctions[T]>>(_: T, ..._: Args) => Promise<Awaited<ReturnType<DevframeRpcServerFunctions[T]>>>;
  broadcast: <T extends keyof DevframeRpcClientFunctions, Args extends Parameters<DevframeRpcClientFunctions[T]>>(_: RpcBroadcastOptions<T, Args>) => Promise<void>;
  getCurrentRpcSession: () => DevframeNodeRpcSession | undefined;
  sharedState: RpcSharedStateHost;
  streaming: RpcStreamingHost;
};
export type ScopedClientFunctions<NS extends string> = { [K in keyof DevframeRpcClientFunctions as K extends `${NS}:${infer R}` ? R : never]: DevframeRpcClientFunctions[K]; };
export type ScopedRpcFn<Registry, NS extends string, T extends string> = `${NS}:${T}` extends keyof Registry ? Extract<Registry[`${NS}:${T}`], AnyRpcFn> : AnyRpcFn;
export type ScopedServerFunctions<NS extends string> = { [K in keyof DevframeRpcServerFunctions as K extends `${NS}:${infer R}` ? R : never]: DevframeRpcServerFunctions[K]; };
export type ScopedSharedStates<NS extends string> = { [K in keyof DevframeRpcSharedStates as K extends `${NS}:${infer R}` ? R : never]: DevframeRpcSharedStates[K]; };
export type SettingsForNamespace<NS extends string> = NS extends keyof DevframeSettingsRegistry ? DevframeSettingsRegistry[NS] extends Record<string, any> ? DevframeSettingsRegistry[NS] : Record<string, any> : Record<string, any>;
export type Thenable<T> = T | Promise<T>;
// #endregion

// #region Functions
export declare function defineDevframe(_: DevframeDefinition): DevframeDefinition;
// #endregion

// #region Variables
export declare const defineRpcFunction: <NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends RpcArgsSchema | undefined = undefined, const RS extends RpcReturnSchema | undefined = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>) => RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>;
// #endregion