chore: server-and-serverless template
This commit is contained in:
4
packages/functions/.pikku/agent/pikku-agent-map.gen.d.ts
vendored
Normal file
4
packages/functions/.pikku/agent/pikku-agent-map.gen.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* This file was generated by @pikku/cli@0.12.48
|
||||
*/
|
||||
export type AgentMap = {}
|
||||
82
packages/functions/.pikku/agent/pikku-agent-types.gen.ts
Normal file
82
packages/functions/.pikku/agent/pikku-agent-types.gen.ts
Normal 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'
|
||||
>
|
||||
}
|
||||
Reference in New Issue
Block a user