chore: server-and-serverless template

This commit is contained in:
e2e
2026-06-28 18:56:43 +02:00
commit b58ae55df5
202 changed files with 9063 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
/**
* This file was generated by @pikku/cli@0.12.48
*/
export type AgentMap = {}

View File

@@ -0,0 +1,82 @@
/**
* This file was generated by @pikku/cli@0.12.48
*/
import {
CoreAIAgent,
PikkuAIMiddlewareHooks,
} from '@pikku/core/ai-agent'
import {
agent as coreAgent,
agentStream as coreAgentStream,
agentResume as coreAgentResume,
agentApprove as coreAgentApprove,
} from '@pikku/core/ai-agent'
import type { PikkuPermission, PikkuMiddleware, Services, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js'
import type { StandardSchemaV1 } from '@standard-schema/spec'
import type { AIAgentMemoryConfig, AIAgentInput } from '@pikku/core/ai-agent'
import type { AgentMap } from './pikku-agent-map.gen.d.js'
type AIAgentConfig<
InputSchema extends StandardSchemaV1 | undefined = undefined,
OutputSchema extends StandardSchemaV1 | undefined = undefined
> = Omit<CoreAIAgent<PikkuPermission, PikkuMiddleware>, 'tools' | 'agents' | 'memory' | 'input' | 'output'> & {
input?: InputSchema
output?: OutputSchema
memory?: Omit<AIAgentMemoryConfig, 'workingMemory'> & { workingMemory?: StandardSchemaV1 }
tools?: object[]
agents?: AIAgentConfig<StandardSchemaV1 | undefined, StandardSchemaV1 | undefined>[]
}
export const pikkuAIAgent = <
InputSchema extends StandardSchemaV1 | undefined = undefined,
OutputSchema extends StandardSchemaV1 | undefined = undefined
>(
agent: AIAgentConfig<InputSchema, OutputSchema>
) => {
return agent
}
export const pikkuAIMiddleware = <
State extends Record<string, unknown> = Record<string, unknown>,
RequiredServices extends Services = Services,
>(
hooks: PikkuAIMiddlewareHooks<State, RequiredServices>
): PikkuAIMiddlewareHooks<State, RequiredServices> => hooks
export const agent = <Name extends keyof AgentMap>(
agentName: Name
) => {
return coreAgent<AgentMap>(agentName as string & keyof AgentMap) as PikkuFunctionConfig<
AIAgentInput,
{ runId: string; result: AgentMap[Name]['output']; usage: { inputTokens: number; outputTokens: number } },
'session' | 'rpc'
>
}
export const agentStream = <Name extends keyof AgentMap>(
agentName?: Name
) => {
return coreAgentStream<AgentMap>(agentName as string & keyof AgentMap) as PikkuFunctionConfig<
{ agentName?: string; message: string; threadId: string; resourceId: string },
void,
'session' | 'rpc'
>
}
export const agentResume = () => {
return coreAgentResume() as PikkuFunctionConfig<
{ runId: string; toolCallId: string; approved: boolean },
void,
'session' | 'rpc'
>
}
export const agentApprove = <Name extends keyof AgentMap>(
agentName: Name
) => {
return coreAgentApprove<AgentMap>(agentName as string & keyof AgentMap) as PikkuFunctionConfig<
{ runId: string; approvals: { toolCallId: string; approved: boolean }[] },
unknown,
'session' | 'rpc'
>
}