chore: server-and-serverless template
This commit is contained in:
192
packages/functions/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts
vendored
Normal file
192
packages/functions/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
/**
|
||||
* This file was generated by @pikku/cli@0.12.48
|
||||
*/
|
||||
/**
|
||||
* This provides the structure needed for typescript to be aware of RPCs and their return 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; }
|
||||
export type AuthHandlerOutput = Promise<any> | Promise<void>
|
||||
export type DeleteAgentThreadInput = { threadId: string; resourceId?: string; }
|
||||
export type DeleteAgentThreadOutput = { deleted: boolean; }
|
||||
export type EdgeEchoInput = {
|
||||
message: string;
|
||||
}
|
||||
export type EdgeEchoOutput = {
|
||||
echoed: string;
|
||||
serverless: boolean;
|
||||
}
|
||||
export type GetAgentThreadMessagesInput = { threadId: string; resourceId?: string; }
|
||||
export type GetAgentThreadMessagesOutput = any[]
|
||||
export type GetAgentThreadRunsInput = { threadId: string; resourceId?: string; }
|
||||
export type GetAgentThreadRunsOutput = any[]
|
||||
export type GetAgentThreadsInput = { agentName?: string; resourceId?: string; limit?: number; offset?: number; }
|
||||
export type GetAgentThreadsOutput = any[]
|
||||
export type GetMessageInput = {}
|
||||
export type GetMessageOutput = {
|
||||
message: string;
|
||||
updatedAt: string;
|
||||
updatedBy: {
|
||||
email: string;
|
||||
name: string | null;
|
||||
} | null;
|
||||
}
|
||||
export type GetSessionInput = {}
|
||||
export type GetSessionOutput = {
|
||||
userId: string;
|
||||
email: string;
|
||||
name: string | null;
|
||||
}
|
||||
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 RemoteRPCHandlerInput = { rpcName: string; data?: unknown; }
|
||||
export type RpcCallerInput = { rpcName: string; data?: unknown; }
|
||||
export type SecretSchema_betterAuthSecret = string
|
||||
export type ServerCounterInput = {}
|
||||
export type ServerCounterOutput = {
|
||||
count: number;
|
||||
pid: number;
|
||||
}
|
||||
export type ServerUptimeInput = {}
|
||||
export type ServerUptimeOutput = {
|
||||
uptimeSeconds: number;
|
||||
nodeVersion: string;
|
||||
rssMb: number;
|
||||
}
|
||||
export type UpdateMessageInput = {
|
||||
message: string;
|
||||
}
|
||||
export type UpdateMessageOutput = {
|
||||
message: string;
|
||||
updatedAt: string;
|
||||
updatedBy: {
|
||||
email: string;
|
||||
name: string | null;
|
||||
} | null;
|
||||
}
|
||||
|
||||
interface RPCHandler<I, O> {
|
||||
input: I;
|
||||
output: O;
|
||||
}
|
||||
|
||||
export type RPCMap = {
|
||||
readonly 'edgeEcho': RPCHandler<EdgeEchoInput, EdgeEchoOutput>,
|
||||
readonly 'getMessage': RPCHandler<GetMessageInput, GetMessageOutput>,
|
||||
readonly 'getSession': RPCHandler<GetSessionInput, GetSessionOutput>,
|
||||
readonly 'serverCounter': RPCHandler<ServerCounterInput, ServerCounterOutput>,
|
||||
readonly 'serverUptime': RPCHandler<ServerUptimeInput, ServerUptimeOutput>,
|
||||
readonly 'updateMessage': RPCHandler<UpdateMessageInput, UpdateMessageOutput>,
|
||||
readonly 'getAgentThreads': RPCHandler<GetAgentThreadsInput, GetAgentThreadsOutput>,
|
||||
readonly 'getAgentThreadMessages': RPCHandler<GetAgentThreadMessagesInput, GetAgentThreadMessagesOutput>,
|
||||
readonly 'getAgentThreadRuns': RPCHandler<GetAgentThreadRunsInput, GetAgentThreadRunsOutput>,
|
||||
readonly 'deleteAgentThread': RPCHandler<DeleteAgentThreadInput, DeleteAgentThreadOutput>,
|
||||
readonly 'pikkuConsoleSetSecret': RPCHandler<PikkuConsoleSetSecretInput, PikkuConsoleSetSecretOutput>,
|
||||
readonly 'pikkuConsoleGetVariable': RPCHandler<PikkuConsoleGetVariableInput, PikkuConsoleGetVariableOutput>,
|
||||
readonly 'pikkuConsoleSetVariable': RPCHandler<PikkuConsoleSetVariableInput, PikkuConsoleSetVariableOutput>,
|
||||
readonly 'pikkuConsoleHasSecret': RPCHandler<PikkuConsoleHasSecretInput, PikkuConsoleHasSecretOutput>,
|
||||
readonly 'pikkuConsoleGetSecret': RPCHandler<PikkuConsoleGetSecretInput, PikkuConsoleGetSecretOutput>,
|
||||
};
|
||||
|
||||
|
||||
// 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<T, Prefix extends string> = 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<ConsoleRPCMap, 'console'>
|
||||
|
||||
type IsAny<T> = 0 extends (1 & T) ? true : false
|
||||
type IsVoidishInput<T> = IsAny<T> extends true
|
||||
? false
|
||||
: [T] extends [void | null | undefined]
|
||||
? true
|
||||
: false
|
||||
|
||||
|
||||
export type RPCInvoke = <Name extends keyof FlattenedRPCMap>(
|
||||
...args: IsVoidishInput<FlattenedRPCMap[Name]['input']> extends true
|
||||
? [name: Name]
|
||||
: [name: Name, data: FlattenedRPCMap[Name]['input']]
|
||||
) => Promise<FlattenedRPCMap[Name]['output']>
|
||||
|
||||
export type RPCRemote = <Name extends keyof FlattenedRPCMap>(
|
||||
...args: IsVoidishInput<FlattenedRPCMap[Name]['input']> extends true
|
||||
? [name: Name]
|
||||
: [name: Name, data: FlattenedRPCMap[Name]['input']]
|
||||
) => Promise<FlattenedRPCMap[Name]['output']>
|
||||
|
||||
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<ConsoleAgentMap, 'console'>
|
||||
|
||||
|
||||
import type { PikkuRPC } from '@pikku/core/rpc'
|
||||
|
||||
interface AIAgentInput {
|
||||
message: string
|
||||
threadId: string
|
||||
resourceId: string
|
||||
}
|
||||
|
||||
export type TypedStartWorkflow = <Name extends keyof FlattenedWorkflowMap>(
|
||||
name: Name,
|
||||
input: FlattenedWorkflowMap[Name]['input'],
|
||||
options?: { startNode?: string }
|
||||
) => Promise<{ runId: string }>
|
||||
|
||||
export type TypedRunWorkflow = <Name extends keyof FlattenedWorkflowMap>(
|
||||
name: Name,
|
||||
input: FlattenedWorkflowMap[Name]['input']
|
||||
) => Promise<FlattenedWorkflowMap[Name]['output']>
|
||||
|
||||
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<any>
|
||||
: <Name extends keyof FlattenedAgentMap>(
|
||||
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<void>
|
||||
: <Name extends keyof FlattenedAgentMap>(
|
||||
name: Name,
|
||||
input: AIAgentInput,
|
||||
options?: { requiresToolApproval?: 'all' | 'explicit' | false }
|
||||
) => Promise<void>
|
||||
|
||||
export type TypedPikkuRPC = PikkuRPC<RPCInvoke, RPCRemote, TypedStartWorkflow, TypedAgentRun, TypedAgentStream>
|
||||
|
||||
199
packages/functions/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts
vendored
Normal file
199
packages/functions/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
/**
|
||||
* This file was generated by @pikku/cli@0.12.48
|
||||
*/
|
||||
/**
|
||||
* This provides the structure needed for typescript to be aware of RPCs and their return 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; }
|
||||
export type AuthHandlerOutput = Promise<any> | Promise<void>
|
||||
export type DeleteAgentThreadInput = { threadId: string; resourceId?: string; }
|
||||
export type DeleteAgentThreadOutput = { deleted: boolean; }
|
||||
export type EdgeEchoInput = {
|
||||
message: string;
|
||||
}
|
||||
export type EdgeEchoOutput = {
|
||||
echoed: string;
|
||||
serverless: boolean;
|
||||
}
|
||||
export type GetAgentThreadMessagesInput = { threadId: string; resourceId?: string; }
|
||||
export type GetAgentThreadMessagesOutput = any[]
|
||||
export type GetAgentThreadRunsInput = { threadId: string; resourceId?: string; }
|
||||
export type GetAgentThreadRunsOutput = any[]
|
||||
export type GetAgentThreadsInput = { agentName?: string; resourceId?: string; limit?: number; offset?: number; }
|
||||
export type GetAgentThreadsOutput = any[]
|
||||
export type GetMessageInput = {}
|
||||
export type GetMessageOutput = {
|
||||
message: string;
|
||||
updatedAt: string;
|
||||
updatedBy: {
|
||||
email: string;
|
||||
name: string | null;
|
||||
} | null;
|
||||
}
|
||||
export type GetSessionInput = {}
|
||||
export type GetSessionOutput = {
|
||||
userId: string;
|
||||
email: string;
|
||||
name: string | null;
|
||||
}
|
||||
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 RemoteRPCHandlerInput = { rpcName: string; data?: unknown; }
|
||||
export type RpcCallerInput = { rpcName: string; data?: unknown; }
|
||||
export type SecretSchema_betterAuthSecret = string
|
||||
export type ServerCounterInput = {}
|
||||
export type ServerCounterOutput = {
|
||||
count: number;
|
||||
pid: number;
|
||||
}
|
||||
export type ServerUptimeInput = {}
|
||||
export type ServerUptimeOutput = {
|
||||
uptimeSeconds: number;
|
||||
nodeVersion: string;
|
||||
rssMb: number;
|
||||
}
|
||||
export type UpdateMessageInput = {
|
||||
message: string;
|
||||
}
|
||||
export type UpdateMessageOutput = {
|
||||
message: string;
|
||||
updatedAt: string;
|
||||
updatedBy: {
|
||||
email: string;
|
||||
name: string | null;
|
||||
} | null;
|
||||
}
|
||||
|
||||
interface RPCHandler<I, O> {
|
||||
input: I;
|
||||
output: O;
|
||||
}
|
||||
|
||||
export type RPCMap = {
|
||||
readonly 'edgeEcho': RPCHandler<EdgeEchoInput, EdgeEchoOutput>,
|
||||
readonly 'getMessage': RPCHandler<GetMessageInput, GetMessageOutput>,
|
||||
readonly 'getSession': RPCHandler<GetSessionInput, GetSessionOutput>,
|
||||
readonly 'serverCounter': RPCHandler<ServerCounterInput, ServerCounterOutput>,
|
||||
readonly 'serverUptime': RPCHandler<ServerUptimeInput, ServerUptimeOutput>,
|
||||
readonly 'updateMessage': RPCHandler<UpdateMessageInput, UpdateMessageOutput>,
|
||||
readonly 'agentCaller': RPCHandler<AgentCallerInput, null>,
|
||||
readonly 'agentStreamCaller': RPCHandler<AgentStreamCallerInput, null>,
|
||||
readonly 'agentApproveCaller': RPCHandler<AgentApproveCallerInput, null>,
|
||||
readonly 'agentResumeCaller': RPCHandler<AgentResumeCallerInput, null>,
|
||||
readonly 'getAgentThreads': RPCHandler<GetAgentThreadsInput, GetAgentThreadsOutput>,
|
||||
readonly 'getAgentThreadMessages': RPCHandler<GetAgentThreadMessagesInput, GetAgentThreadMessagesOutput>,
|
||||
readonly 'getAgentThreadRuns': RPCHandler<GetAgentThreadRunsInput, GetAgentThreadRunsOutput>,
|
||||
readonly 'deleteAgentThread': RPCHandler<DeleteAgentThreadInput, DeleteAgentThreadOutput>,
|
||||
readonly 'authHandler': RPCHandler<null, AuthHandlerOutput>,
|
||||
readonly 'pikkuConsoleSetSecret': RPCHandler<PikkuConsoleSetSecretInput, PikkuConsoleSetSecretOutput>,
|
||||
readonly 'pikkuConsoleGetVariable': RPCHandler<PikkuConsoleGetVariableInput, PikkuConsoleGetVariableOutput>,
|
||||
readonly 'pikkuConsoleSetVariable': RPCHandler<PikkuConsoleSetVariableInput, PikkuConsoleSetVariableOutput>,
|
||||
readonly 'pikkuConsoleHasSecret': RPCHandler<PikkuConsoleHasSecretInput, PikkuConsoleHasSecretOutput>,
|
||||
readonly 'pikkuConsoleGetSecret': RPCHandler<PikkuConsoleGetSecretInput, PikkuConsoleGetSecretOutput>,
|
||||
readonly 'rpcCaller': RPCHandler<RpcCallerInput, null>,
|
||||
readonly 'remoteRPCHandler': RPCHandler<RemoteRPCHandlerInput, null>,
|
||||
};
|
||||
|
||||
|
||||
// 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<T, Prefix extends string> = 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<ConsoleRPCMap, 'console'>
|
||||
|
||||
type IsAny<T> = 0 extends (1 & T) ? true : false
|
||||
type IsVoidishInput<T> = IsAny<T> extends true
|
||||
? false
|
||||
: [T] extends [void | null | undefined]
|
||||
? true
|
||||
: false
|
||||
|
||||
|
||||
export type RPCInvoke = <Name extends keyof FlattenedRPCMap>(
|
||||
...args: IsVoidishInput<FlattenedRPCMap[Name]['input']> extends true
|
||||
? [name: Name]
|
||||
: [name: Name, data: FlattenedRPCMap[Name]['input']]
|
||||
) => Promise<FlattenedRPCMap[Name]['output']>
|
||||
|
||||
export type RPCRemote = <Name extends keyof FlattenedRPCMap>(
|
||||
...args: IsVoidishInput<FlattenedRPCMap[Name]['input']> extends true
|
||||
? [name: Name]
|
||||
: [name: Name, data: FlattenedRPCMap[Name]['input']]
|
||||
) => Promise<FlattenedRPCMap[Name]['output']>
|
||||
|
||||
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<ConsoleAgentMap, 'console'>
|
||||
|
||||
|
||||
import type { PikkuRPC } from '@pikku/core/rpc'
|
||||
|
||||
interface AIAgentInput {
|
||||
message: string
|
||||
threadId: string
|
||||
resourceId: string
|
||||
}
|
||||
|
||||
export type TypedStartWorkflow = <Name extends keyof FlattenedWorkflowMap>(
|
||||
name: Name,
|
||||
input: FlattenedWorkflowMap[Name]['input'],
|
||||
options?: { startNode?: string }
|
||||
) => Promise<{ runId: string }>
|
||||
|
||||
export type TypedRunWorkflow = <Name extends keyof FlattenedWorkflowMap>(
|
||||
name: Name,
|
||||
input: FlattenedWorkflowMap[Name]['input']
|
||||
) => Promise<FlattenedWorkflowMap[Name]['output']>
|
||||
|
||||
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<any>
|
||||
: <Name extends keyof FlattenedAgentMap>(
|
||||
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<void>
|
||||
: <Name extends keyof FlattenedAgentMap>(
|
||||
name: Name,
|
||||
input: AIAgentInput,
|
||||
options?: { requiresToolApproval?: 'all' | 'explicit' | false }
|
||||
) => Promise<void>
|
||||
|
||||
export type TypedPikkuRPC = PikkuRPC<RPCInvoke, RPCRemote, TypedStartWorkflow, TypedAgentRun, TypedAgentStream>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"edgeEcho": "edgeEcho",
|
||||
"getMessage": "getMessage",
|
||||
"getSession": "getSession",
|
||||
"serverCounter": "serverCounter",
|
||||
"serverUptime": "serverUptime",
|
||||
"updateMessage": "updateMessage",
|
||||
"agentCaller": "agentCaller",
|
||||
"agentStreamCaller": "agentStreamCaller",
|
||||
"agentApproveCaller": "agentApproveCaller",
|
||||
"agentResumeCaller": "agentResumeCaller",
|
||||
"getAgentThreads": "getAgentThreads",
|
||||
"getAgentThreadMessages": "getAgentThreadMessages",
|
||||
"getAgentThreadRuns": "getAgentThreadRuns",
|
||||
"deleteAgentThread": "deleteAgentThread",
|
||||
"authHandler": "authHandler",
|
||||
"pikkuConsoleSetSecret": "pikkuConsoleSetSecret",
|
||||
"pikkuConsoleGetVariable": "pikkuConsoleGetVariable",
|
||||
"pikkuConsoleSetVariable": "pikkuConsoleSetVariable",
|
||||
"pikkuConsoleHasSecret": "pikkuConsoleHasSecret",
|
||||
"pikkuConsoleGetSecret": "pikkuConsoleGetSecret",
|
||||
"rpcCaller": "rpcCaller",
|
||||
"remoteRPCHandler": "remoteRPCHandler"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* This file was generated by @pikku/cli@0.12.48
|
||||
*/
|
||||
import { pikkuState } from '@pikku/core/internal'
|
||||
import metaData from './pikku-rpc-wirings-meta.internal.gen.json' with { type: 'json' }
|
||||
pikkuState(null, 'rpc', 'meta', metaData as Record<string, string>)
|
||||
Reference in New Issue
Block a user