/** * This file was generated by @pikku/cli@0.12.76 */ /** * This provides the structure needed for typescript to be aware of RPCs and their return types */ import type { StubCall } from '.bun/@pikku+core@0.12.57/node_modules/@pikku/core/dist/services/stub-tracker' import type { FunctionCoverageReport } from '.bun/@pikku+core@0.12.57/node_modules/@pikku/core/dist/services/v8-coverage-service' import type { WorkflowRunStatus } from '.bun/@pikku+core@0.12.57/node_modules/@pikku/core/dist/wirings/workflow/workflow.types' export type AgentApproveCallerInput = { agentName: string; runId: string; approvals: { toolCallId: string; approved: boolean; }[]; } export type AgentCallerInput = { agentName: string; message: string; threadId: string; resourceId: string; } export type AgentResumeCallerInput = { agentName: string; runId: string; toolCallId: string; approved: boolean; } export type AgentStreamCallerInput = { agentName: string; message: string; threadId: string; resourceId: string; context?: string | undefined; } export type AuthHandlerOutput = Promise | Promise export type DeleteAgentThreadInput = { threadId: string; resourceId?: string | undefined; } export type DeleteAgentThreadOutput = { deleted: boolean; } export type GetAgentThreadMessagesInput = { threadId: string; resourceId?: string | undefined; } export type GetAgentThreadMessagesOutput = any[] export type GetAgentThreadRunsInput = { threadId: string; resourceId?: string | undefined; } export type GetAgentThreadRunsOutput = any[] export type GetAgentThreadsInput = { agentName?: string | undefined; resourceId?: string | undefined; limit?: number | undefined; offset?: number | undefined; } export type GetAgentThreadsOutput = any[] export type GetSessionInput = {} export type GetSessionOutput = { userId: string; email: string; name: string | null; } export type GraphStarterInput = { workflowName: string; nodeId: string; data?: unknown; } export type GraphStarterOutput = { runId: string; } export type PikkuConsoleGetSecretInput = { secretId: string; } export type PikkuConsoleGetSecretOutput = { exists: boolean; value: unknown; } export type PikkuConsoleGetVariableInput = { variableId: string; } export type PikkuConsoleGetVariableOutput = { exists: boolean; value: unknown; } export type PikkuConsoleHasSecretInput = { secretId: string; } export type PikkuConsoleHasSecretOutput = { exists: boolean; } export type PikkuConsoleSetSecretInput = { secretId: string; value: unknown; } export type PikkuConsoleSetSecretOutput = { success: boolean; } export type PikkuConsoleSetVariableInput = { variableId: string; value: unknown; } export type PikkuConsoleSetVariableOutput = { success: boolean; } export type PikkuScenarioGetStubCallsInput = { service?: string | undefined; } export type PikkuScenarioGetStubCallsOutput = StubCall[] export type PikkuScenarioResetLiveCoverageOutput = { enabled: boolean; } export type PikkuScenarioResetStubsOutput = { enabled: boolean; } export type RealtimeEventStreamInput = { topic: string; } export type RealtimeSubscribeInput = { topic: string; } export type RealtimeUnsubscribeInput = { topic: string; } export type RpcCallerInput = { rpcName: string; data?: unknown; } export type SecretSchema_betterAuthSecret = string export type SessionHealthScenarioOutput = { email: string; userId: string; } export type WorkflowRunnerInput = { workflowName: string; data?: unknown; } export type WorkflowStarterInput = { workflowName: string; data?: unknown; } export type WorkflowStarterOutput = { runId: string; } export type WorkflowStatusCheckerInput = { workflowName: string; runId: string; } export type WorkflowStatusStreamFullInput = { workflowName: string; runId: string; } export type WorkflowStatusStreamInput = { workflowName: string; runId: string; } interface RPCHandler { input: I; output: O; } export type RPCMap = { readonly 'getSession': RPCHandler, readonly 'sessionHealthScenario': RPCHandler, readonly 'agentCaller': RPCHandler, readonly 'agentStreamCaller': RPCHandler, readonly 'agentApproveCaller': RPCHandler, readonly 'agentResumeCaller': RPCHandler, readonly 'getAgentThreads': RPCHandler, readonly 'getAgentThreadMessages': RPCHandler, readonly 'getAgentThreadRuns': RPCHandler, readonly 'deleteAgentThread': RPCHandler, readonly 'authHandler': RPCHandler, readonly 'pikkuConsoleSetSecret': RPCHandler, readonly 'pikkuConsoleGetVariable': RPCHandler, readonly 'pikkuConsoleSetVariable': RPCHandler, readonly 'pikkuConsoleHasSecret': RPCHandler, readonly 'pikkuConsoleGetSecret': RPCHandler, readonly 'realtimeSubscribe': RPCHandler, readonly 'realtimeUnsubscribe': RPCHandler, readonly 'realtimeEventStream': RPCHandler, readonly 'rpcCaller': RPCHandler, readonly 'pikkuScenarioTakeLiveCoverage': RPCHandler, readonly 'pikkuScenarioResetLiveCoverage': RPCHandler, readonly 'pikkuScenarioResetStubs': RPCHandler, readonly 'pikkuScenarioGetStubCalls': RPCHandler, readonly 'workflowStarter': RPCHandler, readonly 'workflowRunner': RPCHandler, readonly 'workflowStatusChecker': RPCHandler, readonly 'workflowStatusStream': RPCHandler, readonly 'workflowStatusStreamFull': RPCHandler, readonly 'graphStarter': RPCHandler, }; // Addon package RPC maps import type { RPCMap as ConsoleRPCMap } from '@pikku/addon-console/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.js' // Utility type to prefix keys with namespace (skips 'any' to prevent type poisoning) type PrefixKeys = unknown extends T ? {} : { [K in keyof T as `${Prefix}:${string & K}`]: T[K] } // Merge all RPC maps with namespace prefixes export type FlattenedRPCMap = RPCMap & PrefixKeys type IsAny = 0 extends (1 & T) ? true : false type IsVoidishInput = IsAny extends true ? false : [T] extends [void | null | undefined] ? true : false export type RPCInvoke = ( ...args: IsVoidishInput extends true ? [name: Name] : [name: Name, data: FlattenedRPCMap[Name]['input']] ) => Promise export type RPCRemote = ( ...args: IsVoidishInput extends true ? [name: Name] : [name: Name, data: FlattenedRPCMap[Name]['input']] ) => Promise import type { FlattenedWorkflowMap } from '../workflow/pikku-workflow-map.gen.d.js' import type { AgentMap } from '../agent/pikku-agent-map.gen.d.js' // Addon package Agent maps import type { AgentMap as ConsoleAgentMap } from '@pikku/addon-console/.pikku/agent/pikku-agent-map.gen.d.js' type FlattenedAgentMap = AgentMap & PrefixKeys import type { PikkuRPC } from '@pikku/core/rpc' interface AIAgentInput { message: string threadId: string resourceId: string } export type TypedStartWorkflow = ( name: Name, input: FlattenedWorkflowMap[Name]['input'], options?: { startNode?: string } ) => Promise<{ runId: string }> export type TypedRunWorkflow = ( name: Name, input: FlattenedWorkflowMap[Name]['input'] ) => Promise export type TypedWorkflowStatus = ( workflowName: string, runId: string ) => Promise<{ id: string; status: 'running' | 'suspended' | 'completed' | 'failed' | 'cancelled'; output?: unknown; error?: { message?: string } }> type TypedAgentRun = [keyof FlattenedAgentMap] extends [never] ? (name: string, input: AIAgentInput) => Promise : ( name: Name, input: AIAgentInput ) => Promise<{ runId: string; result: FlattenedAgentMap[Name]['output']; usage: { inputTokens: number; outputTokens: number } }> type TypedAgentStream = [keyof FlattenedAgentMap] extends [never] ? (name: string, input: AIAgentInput, options?: { requiresToolApproval?: 'all' | 'explicit' | false }) => Promise : ( name: Name, input: AIAgentInput, options?: { requiresToolApproval?: 'all' | 'explicit' | false } ) => Promise export type TypedPikkuRPC = PikkuRPC