@pikku/addon-execution 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/.pikku/addon/pikku-addon-types.gen.ts +105 -0
  2. package/.pikku/addon/pikku-package.gen.ts +9 -0
  3. package/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
  4. package/.pikku/agent/pikku-agent-types.gen.ts +82 -0
  5. package/.pikku/channel/pikku-channel-types.gen.ts +177 -0
  6. package/.pikku/console/pikku-addon-meta.gen.json +36 -0
  7. package/.pikku/console/pikku-node-types.gen.ts +8 -0
  8. package/.pikku/function/pikku-function-types.gen.ts +754 -0
  9. package/.pikku/function/pikku-functions-meta-verbose.gen.json +56 -0
  10. package/.pikku/function/pikku-functions-meta.gen.json +40 -0
  11. package/.pikku/function/pikku-functions-meta.gen.ts +7 -0
  12. package/.pikku/function/pikku-functions.gen.ts +10 -0
  13. package/.pikku/http/pikku-http-types.gen.ts +147 -0
  14. package/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
  15. package/.pikku/pikku-bootstrap.gen.ts +8 -0
  16. package/.pikku/pikku-meta-service.gen.ts +10 -0
  17. package/.pikku/pikku-services.gen.ts +41 -0
  18. package/.pikku/pikku-types.gen.ts +21 -0
  19. package/.pikku/queue/pikku-queue-types.gen.ts +27 -0
  20. package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +128 -0
  21. package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +130 -0
  22. package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +4 -0
  23. package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
  24. package/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
  25. package/.pikku/schemas/register.gen.ts +19 -0
  26. package/.pikku/schemas/schemas/ExecuteInput.schema.json +1 -0
  27. package/.pikku/schemas/schemas/ExecuteOutput.schema.json +1 -0
  28. package/.pikku/schemas/schemas/SpawnCommandInput.schema.json +1 -0
  29. package/.pikku/schemas/schemas/SpawnCommandOutput.schema.json +1 -0
  30. package/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
  31. package/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
  32. package/.pikku/secrets/pikku-secrets.gen.ts +21 -0
  33. package/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
  34. package/.pikku/variables/pikku-variable-types.gen.ts +5 -0
  35. package/.pikku/variables/pikku-variables-meta.gen.json +1 -0
  36. package/.pikku/variables/pikku-variables.gen.ts +21 -0
  37. package/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
  38. package/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
  39. package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
  40. package/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
  41. package/README.md +16 -0
  42. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +65 -0
  43. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -0
  44. package/dist/.pikku/addon/pikku-addon-types.gen.js +78 -0
  45. package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -0
  46. package/dist/.pikku/addon/pikku-addon-types.gen.ts +105 -0
  47. package/dist/.pikku/addon/pikku-package.gen.d.ts +2 -0
  48. package/dist/.pikku/addon/pikku-package.gen.d.ts.map +1 -0
  49. package/dist/.pikku/addon/pikku-package.gen.js +9 -0
  50. package/dist/.pikku/addon/pikku-package.gen.js.map +1 -0
  51. package/dist/.pikku/addon/pikku-package.gen.ts +9 -0
  52. package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
  53. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +47 -0
  54. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -0
  55. package/dist/.pikku/agent/pikku-agent-types.gen.js +18 -0
  56. package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -0
  57. package/dist/.pikku/agent/pikku-agent-types.gen.ts +82 -0
  58. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +112 -0
  59. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts.map +1 -0
  60. package/dist/.pikku/channel/pikku-channel-types.gen.js +60 -0
  61. package/dist/.pikku/channel/pikku-channel-types.gen.js.map +1 -0
  62. package/dist/.pikku/channel/pikku-channel-types.gen.ts +177 -0
  63. package/dist/.pikku/console/pikku-addon-meta.gen.json +36 -0
  64. package/dist/.pikku/console/pikku-node-types.gen.d.ts +7 -0
  65. package/dist/.pikku/console/pikku-node-types.gen.d.ts.map +1 -0
  66. package/dist/.pikku/console/pikku-node-types.gen.js +2 -0
  67. package/dist/.pikku/console/pikku-node-types.gen.js.map +1 -0
  68. package/dist/.pikku/console/pikku-node-types.gen.ts +8 -0
  69. package/dist/.pikku/function/pikku-function-types.gen.d.ts +490 -0
  70. package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -0
  71. package/dist/.pikku/function/pikku-function-types.gen.js +334 -0
  72. package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -0
  73. package/dist/.pikku/function/pikku-function-types.gen.ts +754 -0
  74. package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +56 -0
  75. package/dist/.pikku/function/pikku-functions-meta.gen.d.ts +2 -0
  76. package/dist/.pikku/function/pikku-functions-meta.gen.d.ts.map +1 -0
  77. package/dist/.pikku/function/pikku-functions-meta.gen.js +7 -0
  78. package/dist/.pikku/function/pikku-functions-meta.gen.js.map +1 -0
  79. package/dist/.pikku/function/pikku-functions-meta.gen.json +40 -0
  80. package/dist/.pikku/function/pikku-functions-meta.gen.ts +7 -0
  81. package/dist/.pikku/function/pikku-functions.gen.d.ts +2 -0
  82. package/dist/.pikku/function/pikku-functions.gen.d.ts.map +1 -0
  83. package/dist/.pikku/function/pikku-functions.gen.js +10 -0
  84. package/dist/.pikku/function/pikku-functions.gen.js.map +1 -0
  85. package/dist/.pikku/function/pikku-functions.gen.ts +10 -0
  86. package/dist/.pikku/http/pikku-http-types.gen.d.ts +120 -0
  87. package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -0
  88. package/dist/.pikku/http/pikku-http-types.gen.js +72 -0
  89. package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -0
  90. package/dist/.pikku/http/pikku-http-types.gen.ts +147 -0
  91. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +131 -0
  92. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts.map +1 -0
  93. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +38 -0
  94. package/dist/.pikku/mcp/pikku-mcp-types.gen.js.map +1 -0
  95. package/dist/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
  96. package/dist/.pikku/pikku-bootstrap.gen.d.ts +9 -0
  97. package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -0
  98. package/dist/.pikku/pikku-bootstrap.gen.js +9 -0
  99. package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -0
  100. package/dist/.pikku/pikku-bootstrap.gen.ts +8 -0
  101. package/dist/.pikku/pikku-meta-service.gen.d.ts +8 -0
  102. package/dist/.pikku/pikku-meta-service.gen.d.ts.map +1 -0
  103. package/dist/.pikku/pikku-meta-service.gen.js +10 -0
  104. package/dist/.pikku/pikku-meta-service.gen.js.map +1 -0
  105. package/dist/.pikku/pikku-meta-service.gen.ts +10 -0
  106. package/dist/.pikku/pikku-services.gen.d.ts +34 -0
  107. package/dist/.pikku/pikku-services.gen.d.ts.map +1 -0
  108. package/dist/.pikku/pikku-services.gen.js +29 -0
  109. package/dist/.pikku/pikku-services.gen.js.map +1 -0
  110. package/dist/.pikku/pikku-services.gen.ts +41 -0
  111. package/dist/.pikku/pikku-types.gen.d.ts +12 -0
  112. package/dist/.pikku/pikku-types.gen.d.ts.map +1 -0
  113. package/dist/.pikku/pikku-types.gen.js +17 -0
  114. package/dist/.pikku/pikku-types.gen.js.map +1 -0
  115. package/dist/.pikku/pikku-types.gen.ts +21 -0
  116. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +24 -0
  117. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts.map +1 -0
  118. package/dist/.pikku/queue/pikku-queue-types.gen.js +17 -0
  119. package/dist/.pikku/queue/pikku-queue-types.gen.js.map +1 -0
  120. package/dist/.pikku/queue/pikku-queue-types.gen.ts +27 -0
  121. package/dist/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +128 -0
  122. package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +130 -0
  123. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +2 -0
  124. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts.map +1 -0
  125. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +7 -0
  126. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js.map +1 -0
  127. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +4 -0
  128. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
  129. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +22 -0
  130. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts.map +1 -0
  131. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +17 -0
  132. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js.map +1 -0
  133. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
  134. package/dist/.pikku/schemas/register.gen.d.ts +2 -0
  135. package/dist/.pikku/schemas/register.gen.d.ts.map +1 -0
  136. package/dist/.pikku/schemas/register.gen.js +13 -0
  137. package/dist/.pikku/schemas/register.gen.js.map +1 -0
  138. package/dist/.pikku/schemas/register.gen.ts +19 -0
  139. package/dist/.pikku/schemas/schemas/ExecuteInput.schema.json +1 -0
  140. package/dist/.pikku/schemas/schemas/ExecuteOutput.schema.json +1 -0
  141. package/dist/.pikku/schemas/schemas/SpawnCommandInput.schema.json +1 -0
  142. package/dist/.pikku/schemas/schemas/SpawnCommandOutput.schema.json +1 -0
  143. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +6 -0
  144. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts.map +1 -0
  145. package/dist/.pikku/secrets/pikku-secret-types.gen.js +5 -0
  146. package/dist/.pikku/secrets/pikku-secret-types.gen.js.map +1 -0
  147. package/dist/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
  148. package/dist/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
  149. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +12 -0
  150. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts.map +1 -0
  151. package/dist/.pikku/secrets/pikku-secrets.gen.js +11 -0
  152. package/dist/.pikku/secrets/pikku-secrets.gen.js.map +1 -0
  153. package/dist/.pikku/secrets/pikku-secrets.gen.ts +21 -0
  154. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +114 -0
  155. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts.map +1 -0
  156. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +34 -0
  157. package/dist/.pikku/trigger/pikku-trigger-types.gen.js.map +1 -0
  158. package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
  159. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +6 -0
  160. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts.map +1 -0
  161. package/dist/.pikku/variables/pikku-variable-types.gen.js +5 -0
  162. package/dist/.pikku/variables/pikku-variable-types.gen.js.map +1 -0
  163. package/dist/.pikku/variables/pikku-variable-types.gen.ts +5 -0
  164. package/dist/.pikku/variables/pikku-variables-meta.gen.json +1 -0
  165. package/dist/.pikku/variables/pikku-variables.gen.d.ts +12 -0
  166. package/dist/.pikku/variables/pikku-variables.gen.d.ts.map +1 -0
  167. package/dist/.pikku/variables/pikku-variables.gen.js +11 -0
  168. package/dist/.pikku/variables/pikku-variables.gen.js.map +1 -0
  169. package/dist/.pikku/variables/pikku-variables.gen.ts +21 -0
  170. package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
  171. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +90 -0
  172. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -0
  173. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +18 -0
  174. package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -0
  175. package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
  176. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts +2 -0
  177. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts.map +1 -0
  178. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +7 -0
  179. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js.map +1 -0
  180. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
  181. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +5 -0
  182. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts.map +1 -0
  183. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +5 -0
  184. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js.map +1 -0
  185. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
  186. package/dist/src/functions/execute.function.d.ts +37 -0
  187. package/dist/src/functions/execute.function.d.ts.map +1 -0
  188. package/dist/src/functions/execute.function.js +31 -0
  189. package/dist/src/functions/execute.function.js.map +1 -0
  190. package/dist/src/functions/spawn.function.d.ts +41 -0
  191. package/dist/src/functions/spawn.function.d.ts.map +1 -0
  192. package/dist/src/functions/spawn.function.js +38 -0
  193. package/dist/src/functions/spawn.function.js.map +1 -0
  194. package/dist/src/index.d.ts +3 -0
  195. package/dist/src/index.d.ts.map +1 -0
  196. package/dist/src/index.js +3 -0
  197. package/dist/src/index.js.map +1 -0
  198. package/dist/src/services.d.ts +2 -0
  199. package/dist/src/services.d.ts.map +1 -0
  200. package/dist/src/services.js +5 -0
  201. package/dist/src/services.js.map +1 -0
  202. package/package.json +39 -0
@@ -0,0 +1,167 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ import { WorkflowCancelledException } from '@pikku/core/workflow'
5
+ import { template } from '@pikku/core/workflow'
6
+ import {
7
+ pikkuWorkflowGraph as corePikkuWorkflowGraph,
8
+ type PikkuWorkflowGraphConfig,
9
+ type PikkuWorkflowGraphResult,
10
+ } from '@pikku/core/workflow'
11
+ import type { PikkuWorkflowWire, WorkflowStepOptions } from '@pikku/core/workflow'
12
+
13
+ export { WorkflowCancelledException }
14
+ import type { PikkuFunctionSessionless, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js'
15
+ import type { FlattenedRPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.d.js'
16
+ import type { FlattenedWorkflowMap } from './pikku-workflow-map.gen.d.js'
17
+
18
+ export { template }
19
+
20
+ export interface TypedWorkflow extends PikkuWorkflowWire {
21
+ do<K extends keyof FlattenedRPCMap>(
22
+ stepName: string,
23
+ rpcName: K,
24
+ data: FlattenedRPCMap[K]['input'],
25
+ options?: WorkflowStepOptions
26
+ ): Promise<FlattenedRPCMap[K]['output']>
27
+
28
+ do<K extends keyof FlattenedWorkflowMap>(
29
+ stepName: string,
30
+ workflowName: K,
31
+ data: FlattenedWorkflowMap[K]['input'],
32
+ options?: WorkflowStepOptions
33
+ ): Promise<FlattenedWorkflowMap[K]['output']>
34
+
35
+ do<T>(
36
+ stepName: string,
37
+ fn: () => T | Promise<T>,
38
+ options?: WorkflowStepOptions
39
+ ): Promise<T>
40
+ }
41
+
42
+ import type { StandardSchemaV1 } from '@standard-schema/spec'
43
+ import type { InferSchemaOutput, PikkuPermission, PikkuMiddleware, NodeConfig, PikkuApprovalDescription } from '../function/pikku-function-types.gen.js'
44
+ import { PikkuError } from '@pikku/core/errors'
45
+ import type { CorePermissionGroup } from '@pikku/core'
46
+
47
+ export type PikkuFunctionWorkflow<
48
+ In = unknown,
49
+ Out = never
50
+ > = PikkuFunctionSessionless<In, Out, 'workflow'>
51
+
52
+ export type PikkuWorkflowConfigWithSchema<
53
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
54
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
55
+ > = {
56
+ title?: string
57
+ description?: string
58
+ tags?: string[]
59
+ expose?: boolean
60
+ internal?: boolean
61
+ override?: string
62
+ version?: number
63
+ remote?: boolean
64
+ mcp?: boolean
65
+ readonly?: boolean
66
+ approvalRequired?: boolean
67
+ approvalDescription?: InputSchema extends StandardSchemaV1 ? PikkuApprovalDescription<InferSchemaOutput<InputSchema>> : never
68
+ func: PikkuFunctionWorkflow<
69
+ InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
70
+ OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown
71
+ >
72
+ auth?: boolean
73
+ permissions?: InputSchema extends StandardSchemaV1 ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>> : undefined
74
+ middleware?: PikkuMiddleware[]
75
+ input?: InputSchema
76
+ output?: OutputSchema
77
+ node?: NodeConfig
78
+ errors?: Array<typeof PikkuError>
79
+ inline?: boolean
80
+ }
81
+
82
+ export function pikkuWorkflowFunc<
83
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
84
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
85
+ >(
86
+ config: PikkuWorkflowConfigWithSchema<InputSchema, OutputSchema>
87
+ ): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'workflow', PikkuFunctionWorkflow<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown>, InputSchema, OutputSchema>
88
+ export function pikkuWorkflowFunc<In, Out = unknown>(
89
+ func:
90
+ | PikkuFunctionWorkflow<In, Out>
91
+ | PikkuFunctionConfig<In, Out, 'workflow', PikkuFunctionWorkflow<In, Out>>
92
+ ): PikkuFunctionConfig<In, Out, 'workflow'>
93
+ export function pikkuWorkflowFunc(func: any) {
94
+ return typeof func === 'function' ? { func } : func
95
+ }
96
+
97
+ export function pikkuWorkflowComplexFunc<
98
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
99
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
100
+ >(
101
+ config: PikkuWorkflowConfigWithSchema<InputSchema, OutputSchema>
102
+ ): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'workflow', PikkuFunctionWorkflow<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown>, InputSchema, OutputSchema>
103
+ export function pikkuWorkflowComplexFunc<In, Out = unknown>(
104
+ func:
105
+ | PikkuFunctionWorkflow<In, Out>
106
+ | PikkuFunctionConfig<In, Out, 'workflow', PikkuFunctionWorkflow<In, Out>>
107
+ ): PikkuFunctionConfig<In, Out, 'workflow'>
108
+ export function pikkuWorkflowComplexFunc(func: any) {
109
+ return typeof func === 'function' ? { func } : func
110
+ }
111
+
112
+ type TypedRef<T> = { $ref: string; path?: string } & { __phantomType?: T }
113
+
114
+ type TemplateString = {
115
+ $template: {
116
+ parts: string[]
117
+ expressions: Array<{ $ref: string; path?: string }>
118
+ }
119
+ } & { __brand: 'TemplateString' }
120
+
121
+ type InputWithRefs<T> = {
122
+ [K in keyof T]?: T[K] | TypedRef<T[K]> | TypedRef<unknown> | TemplateString
123
+ }
124
+
125
+ type NodeInputType<FuncMap extends Record<string, string>, K extends keyof FuncMap> =
126
+ FuncMap[K] extends keyof FlattenedRPCMap
127
+ ? InputWithRefs<FlattenedRPCMap[FuncMap[K]]['input']>
128
+ : Record<string, unknown>
129
+
130
+ type NodeOutputKeys<FuncMap extends Record<string, string>, N extends string> =
131
+ N extends keyof FuncMap
132
+ ? FuncMap[N] extends keyof FlattenedRPCMap
133
+ ? keyof FlattenedRPCMap[FuncMap[N]]['output'] & string
134
+ : string
135
+ : string
136
+
137
+ type RefFunction<FuncMap extends Record<string, string>> = {
138
+ <N extends Extract<keyof FuncMap, string>>(
139
+ nodeId: N,
140
+ path: NodeOutputKeys<FuncMap, N>
141
+ ): TypedRef<unknown>
142
+ (nodeId: 'trigger' | '$item', path?: string): TypedRef<unknown>
143
+ }
144
+
145
+ type TemplateFunction = (templateStr: string, refs: TypedRef<unknown>[]) => TemplateString
146
+
147
+ type GraphNodeConfigMap<FuncMap extends Record<string, string>> = {
148
+ [K in Extract<keyof FuncMap, string>]?: {
149
+ next?: NextConfig<Extract<keyof FuncMap, string>>
150
+ input?:
151
+ | NodeInputType<FuncMap, K>
152
+ | (() => NodeInputType<FuncMap, K>)
153
+ | ((ref: RefFunction<FuncMap>, template: TemplateFunction) => NodeInputType<FuncMap, K>)
154
+ onError?: Extract<keyof FuncMap, string> | Extract<keyof FuncMap, string>[]
155
+ }
156
+ }
157
+
158
+ type NextConfig<NodeIds extends string> = NodeIds | NodeIds[] | { if: string; then: NodeIds; else?: NodeIds }
159
+
160
+ export function pikkuWorkflowGraph<
161
+ const FuncMap extends Record<string, keyof FlattenedRPCMap & string>
162
+ >(
163
+ config: PikkuWorkflowGraphConfig<FuncMap, GraphNodeConfigMap<FuncMap>>
164
+ ): PikkuWorkflowGraphResult {
165
+ return corePikkuWorkflowGraph(config as any)
166
+ }
167
+
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ import { pikkuState } from '@pikku/core/internal'
5
+ import type { SerializedWorkflowGraphs } from '@pikku/inspector/workflow-graph'
6
+
7
+ const workflowsMeta: SerializedWorkflowGraphs = {}
8
+
9
+ pikkuState('@pikku/addon-execution', 'workflows', 'meta', workflowsMeta)
@@ -0,0 +1,3 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # @pikku/addon-execution
2
+
3
+ Run shell commands and spawn processes from a Pikku workflow, capturing
4
+ `stdout`, `stderr`, and the process `exitCode`. Dependency-free — built on
5
+ Node's `child_process`.
6
+
7
+ ## Functions
8
+
9
+ - **`execution:execute`** — run a shell command string (`exec`). Supports `cwd`
10
+ and `timeout`. Returns `{ stdout, stderr, exitCode }`.
11
+ - **`execution:spawnCommand`** — spawn a program with an argument array and **no
12
+ shell** (injection-proof). Supports `cwd` and `timeout`. Returns
13
+ `{ stdout, stderr, exitCode }`.
14
+
15
+ Neither function throws on a non-zero exit — the exit code is returned so the
16
+ caller decides how to handle failure.
@@ -0,0 +1,65 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ /**
5
+ * Addon package types for pikkuAddonConfig and pikkuAddonServices
6
+ */
7
+ import type { CreateConfig, PikkuWire } from '@pikku/core';
8
+ import type { SingletonServices } from '../../types/application-types.d.js';
9
+ import type { Config } from '../../types/application-types.d.js';
10
+ import type { RequiredSingletonServices } from '../pikku-services.gen.js';
11
+ import { TypedSecretService } from '../secrets/pikku-secrets.gen.js';
12
+ import { TypedVariablesService } from '../variables/pikku-variables.gen.js';
13
+ /**
14
+ * Base services provided to addon package service factories.
15
+ * These are always available from the parent application.
16
+ */
17
+ export type AddonBaseServices = {
18
+ logger: SingletonServices['logger'];
19
+ variables: TypedVariablesService;
20
+ secrets: TypedSecretService;
21
+ };
22
+ /**
23
+ * Creates a Pikku config factory for addon packages.
24
+ * Unlike pikkuConfig, this receives AddonBaseServices (logger, variables, secrets)
25
+ * from the parent application, so addon packages can read variables/secrets during config creation.
26
+ */
27
+ export declare const pikkuAddonConfig: <ExistingServices extends Omit<Partial<SingletonServices>, "variables" | "secrets"> & AddonBaseServices>(func: (services: ExistingServices) => Promise<Config>) => CreateConfig<Config>;
28
+ /**
29
+ * Creates a Pikku singleton services factory for addon packages.
30
+ * Unlike pikkuServices, this expects the parent application to provide
31
+ * logger, variables, and secrets - no fallbacks needed.
32
+ *
33
+ * @param func - Addon services factory function that receives config and base services
34
+ * @returns The singleton services factory function
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * export const createSingletonServices = pikkuAddonServices(async (
39
+ * config,
40
+ * { secrets }
41
+ * ) => {
42
+ * const creds = await secrets.getSecret<GithubCredentials>('GITHUB_CREDENTIALS')
43
+ * const github = new GithubService(creds)
44
+ * return { github }
45
+ * })
46
+ * ```
47
+ */
48
+ export declare const pikkuAddonServices: <T extends Record<string, any>, ExistingServices extends Omit<Partial<SingletonServices>, "variables" | "secrets"> & AddonBaseServices>(func: (config: Config, services: ExistingServices) => Promise<T>) => (config: Config, existingServices?: Partial<SingletonServices>) => Promise<RequiredSingletonServices>;
49
+ /**
50
+ * Creates a Pikku wire services factory for addon packages.
51
+ * Wire services are created per-request and have access to the HTTP request context.
52
+ *
53
+ * @param func - Wire services factory function that receives singleton services and the wire context
54
+ * @returns The wire services factory function
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * export const createWireServices = pikkuAddonWireServices(async (services, wire) => {
59
+ * const authHeader = wire.http?.request?.header('authorization')
60
+ * return { myService: new MyService(authHeader) }
61
+ * })
62
+ * ```
63
+ */
64
+ export declare const pikkuAddonWireServices: <ExistingServices extends Omit<Partial<SingletonServices>, "variables" | "secrets"> & AddonBaseServices>(func: (services: ExistingServices, wire: PikkuWire) => Promise<Record<string, any>>) => any;
65
+ //# sourceMappingURL=pikku-addon-types.gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pikku-addon-types.gen.d.ts","sourceRoot":"","sources":["../../../.pikku/addon/pikku-addon-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;AAEH,OAAO,K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BAAgB,SAAS,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC,GAAG,iBAAiB,EAC3I,MAAM,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAM7E,GACP,CAAA"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ /**
5
+ * Addon package types for pikkuAddonConfig and pikkuAddonServices
6
+ */
7
+ import { TypedSecretService } from '../secrets/pikku-secrets.gen.js';
8
+ import { TypedVariablesService } from '../variables/pikku-variables.gen.js';
9
+ /**
10
+ * Creates a Pikku config factory for addon packages.
11
+ * Unlike pikkuConfig, this receives AddonBaseServices (logger, variables, secrets)
12
+ * from the parent application, so addon packages can read variables/secrets during config creation.
13
+ */
14
+ export const pikkuAddonConfig = (func) => {
15
+ return (async (_variables, existingServices) => {
16
+ const { secrets, variables, ...rest } = (existingServices ?? {});
17
+ return func({ ...rest, secrets: new TypedSecretService(secrets), variables: new TypedVariablesService(variables) });
18
+ });
19
+ };
20
+ /**
21
+ * Creates a Pikku singleton services factory for addon packages.
22
+ * Unlike pikkuServices, this expects the parent application to provide
23
+ * logger, variables, and secrets - no fallbacks needed.
24
+ *
25
+ * @param func - Addon services factory function that receives config and base services
26
+ * @returns The singleton services factory function
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * export const createSingletonServices = pikkuAddonServices(async (
31
+ * config,
32
+ * { secrets }
33
+ * ) => {
34
+ * const creds = await secrets.getSecret<GithubCredentials>('GITHUB_CREDENTIALS')
35
+ * const github = new GithubService(creds)
36
+ * return { github }
37
+ * })
38
+ * ```
39
+ */
40
+ export const pikkuAddonServices = (func) => {
41
+ return async (config, existingServices) => {
42
+ const { logger, variables, secrets, schema } = (existingServices ?? {});
43
+ const typedVariables = new TypedVariablesService(variables);
44
+ const typedSecrets = new TypedSecretService(secrets);
45
+ const result = await func(config, { ...existingServices, logger, variables: typedVariables, secrets: typedSecrets });
46
+ return {
47
+ config,
48
+ logger,
49
+ schema,
50
+ variables: typedVariables,
51
+ secrets: typedSecrets,
52
+ ...result,
53
+ };
54
+ };
55
+ };
56
+ /**
57
+ * Creates a Pikku wire services factory for addon packages.
58
+ * Wire services are created per-request and have access to the HTTP request context.
59
+ *
60
+ * @param func - Wire services factory function that receives singleton services and the wire context
61
+ * @returns The wire services factory function
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * export const createWireServices = pikkuAddonWireServices(async (services, wire) => {
66
+ * const authHeader = wire.http?.request?.header('authorization')
67
+ * return { myService: new MyService(authHeader) }
68
+ * })
69
+ * ```
70
+ */
71
+ export const pikkuAddonWireServices = (func) => {
72
+ return ((services, wire) => {
73
+ const typedVariables = new TypedVariablesService(services.variables);
74
+ const typedSecrets = new TypedSecretService(services.secrets);
75
+ return func({ ...services, variables: typedVariables, secrets: typedSecrets }, wire);
76
+ });
77
+ };
78
+ //# sourceMappingURL=pikku-addon-types.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pikku-addon-types.gen.js","sourceRoot":"","sources":["../../../.pikku/addon/pikku-addon-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;AAMH,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAgB3E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,IAAqD,EAC/B,EAAE;IACxB,OAAO,CAAC,KAAK,EAAE,UAAe,EAAE,gBAA6C,EAAmB,EAAE;QAChG,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAiC,CAAA;QAChG,OAAO,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,IAAI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AAsB,EAAE,IAAI,CAAC,CAAA;IAC1G,CAAC,CAAQ,CAAA;AACX,CAAC,CAAA"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ /**
5
+ * Addon package types for pikkuAddonConfig and pikkuAddonServices
6
+ */
7
+
8
+ import type { CreateConfig, PikkuWire } from '@pikku/core'
9
+ import type { SingletonServices } from '../../types/application-types.d.js'
10
+ import type { Config } from '../../types/application-types.d.js'
11
+ import type { RequiredSingletonServices } from '../pikku-services.gen.js'
12
+ import { TypedSecretService } from '../secrets/pikku-secrets.gen.js'
13
+ import { TypedVariablesService } from '../variables/pikku-variables.gen.js'
14
+
15
+
16
+
17
+
18
+
19
+ /**
20
+ * Base services provided to addon package service factories.
21
+ * These are always available from the parent application.
22
+ */
23
+ export type AddonBaseServices = {
24
+ logger: SingletonServices['logger']
25
+ variables: TypedVariablesService
26
+ secrets: TypedSecretService
27
+ }
28
+
29
+ /**
30
+ * Creates a Pikku config factory for addon packages.
31
+ * Unlike pikkuConfig, this receives AddonBaseServices (logger, variables, secrets)
32
+ * from the parent application, so addon packages can read variables/secrets during config creation.
33
+ */
34
+ export const pikkuAddonConfig = <ExistingServices extends Omit<Partial<SingletonServices>, 'variables' | 'secrets'> & AddonBaseServices>(
35
+ func: (services: ExistingServices) => Promise<Config>
36
+ ): CreateConfig<Config> => {
37
+ return (async (_variables: any, existingServices?: Partial<SingletonServices>): Promise<Config> => {
38
+ const { secrets, variables, ...rest } = (existingServices ?? {}) as unknown as SingletonServices
39
+ return func({ ...rest, secrets: new TypedSecretService(secrets), variables: new TypedVariablesService(variables) } as ExistingServices)
40
+ }) as unknown as CreateConfig<Config>
41
+ }
42
+
43
+ /**
44
+ * Creates a Pikku singleton services factory for addon packages.
45
+ * Unlike pikkuServices, this expects the parent application to provide
46
+ * logger, variables, and secrets - no fallbacks needed.
47
+ *
48
+ * @param func - Addon services factory function that receives config and base services
49
+ * @returns The singleton services factory function
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * export const createSingletonServices = pikkuAddonServices(async (
54
+ * config,
55
+ * { secrets }
56
+ * ) => {
57
+ * const creds = await secrets.getSecret<GithubCredentials>('GITHUB_CREDENTIALS')
58
+ * const github = new GithubService(creds)
59
+ * return { github }
60
+ * })
61
+ * ```
62
+ */
63
+ export const pikkuAddonServices = <T extends Record<string, any>, ExistingServices extends Omit<Partial<SingletonServices>, 'variables' | 'secrets'> & AddonBaseServices>(
64
+ func: (config: Config, services: ExistingServices) => Promise<T>
65
+ ) => {
66
+ return async (config: Config, existingServices?: Partial<SingletonServices>): Promise<RequiredSingletonServices> => {
67
+ const { logger, variables, secrets, schema } = (existingServices ?? {}) as unknown as SingletonServices
68
+ const typedVariables = new TypedVariablesService(variables)
69
+ const typedSecrets = new TypedSecretService(secrets)
70
+ const result = await func(config, { ...existingServices, logger, variables: typedVariables, secrets: typedSecrets } as ExistingServices)
71
+ return {
72
+ config,
73
+ logger,
74
+ schema,
75
+ variables: typedVariables,
76
+ secrets: typedSecrets,
77
+ ...result,
78
+ } as unknown as RequiredSingletonServices
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Creates a Pikku wire services factory for addon packages.
84
+ * Wire services are created per-request and have access to the HTTP request context.
85
+ *
86
+ * @param func - Wire services factory function that receives singleton services and the wire context
87
+ * @returns The wire services factory function
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * export const createWireServices = pikkuAddonWireServices(async (services, wire) => {
92
+ * const authHeader = wire.http?.request?.header('authorization')
93
+ * return { myService: new MyService(authHeader) }
94
+ * })
95
+ * ```
96
+ */
97
+ export const pikkuAddonWireServices = <ExistingServices extends Omit<Partial<SingletonServices>, 'variables' | 'secrets'> & AddonBaseServices>(
98
+ func: (services: ExistingServices, wire: PikkuWire) => Promise<Record<string, any>>
99
+ ) => {
100
+ return ((services: any, wire: PikkuWire) => {
101
+ const typedVariables = new TypedVariablesService(services.variables)
102
+ const typedSecrets = new TypedSecretService(services.secrets)
103
+ return func({ ...services, variables: typedVariables, secrets: typedSecrets } as ExistingServices, wire)
104
+ }) as any
105
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=pikku-package.gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pikku-package.gen.d.ts","sourceRoot":"","sources":["../../../.pikku/addon/pikku-package.gen.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ import { pikkuState } from '@pikku/core/internal';
5
+ import { createSingletonServices as createSingletonServices } from '../../src/services.js';
6
+ pikkuState('@pikku/addon-execution', 'package', 'factories', {
7
+ createSingletonServices,
8
+ });
9
+ //# sourceMappingURL=pikku-package.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pikku-package.gen.js","sourceRoot":"","sources":["../../../.pikku/addon/pikku-package.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,uBAAuB,IAAI,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAE1F,UAAU,CAAC,wBAAwB,EAAE,SAAS,EAAE,WAAW,EAAE;IAC3D,uBAAuB;CACxB,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ import { pikkuState } from '@pikku/core/internal'
5
+ import { createSingletonServices as createSingletonServices } from '../../src/services.js'
6
+
7
+ pikkuState('@pikku/addon-execution', 'package', 'factories', {
8
+ createSingletonServices,
9
+ })
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ export type AgentMap = {}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ import { CoreAIAgent, PikkuAIMiddlewareHooks } from '@pikku/core/ai-agent';
5
+ import type { PikkuPermission, PikkuMiddleware, Services, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js';
6
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
7
+ import type { AIAgentMemoryConfig, AIAgentInput } from '@pikku/core/ai-agent';
8
+ import type { AgentMap } from './pikku-agent-map.gen.d.js';
9
+ type AIAgentConfig<InputSchema extends StandardSchemaV1 | undefined = undefined, OutputSchema extends StandardSchemaV1 | undefined = undefined> = Omit<CoreAIAgent<PikkuPermission, PikkuMiddleware>, 'tools' | 'agents' | 'memory' | 'input' | 'output'> & {
10
+ input?: InputSchema;
11
+ output?: OutputSchema;
12
+ memory?: Omit<AIAgentMemoryConfig, 'workingMemory'> & {
13
+ workingMemory?: StandardSchemaV1;
14
+ };
15
+ tools?: object[];
16
+ agents?: AIAgentConfig<StandardSchemaV1 | undefined, StandardSchemaV1 | undefined>[];
17
+ };
18
+ export declare const pikkuAIAgent: <InputSchema extends StandardSchemaV1 | undefined = undefined, OutputSchema extends StandardSchemaV1 | undefined = undefined>(agent: AIAgentConfig<InputSchema, OutputSchema>) => AIAgentConfig<InputSchema, OutputSchema>;
19
+ export declare const pikkuAIMiddleware: <State extends Record<string, unknown> = Record<string, unknown>, RequiredServices extends Services = Services>(hooks: PikkuAIMiddlewareHooks<State, RequiredServices>) => PikkuAIMiddlewareHooks<State, RequiredServices>;
20
+ export declare const agent: <Name extends keyof AgentMap>(agentName: Name) => PikkuFunctionConfig<AIAgentInput, {
21
+ runId: string;
22
+ result: AgentMap[Name]["output"];
23
+ usage: {
24
+ inputTokens: number;
25
+ outputTokens: number;
26
+ };
27
+ }, "session" | "rpc">;
28
+ export declare const agentStream: <Name extends keyof AgentMap>(agentName?: Name | undefined) => PikkuFunctionConfig<{
29
+ agentName?: string;
30
+ message: string;
31
+ threadId: string;
32
+ resourceId: string;
33
+ }, void, "session" | "rpc">;
34
+ export declare const agentResume: () => PikkuFunctionConfig<{
35
+ runId: string;
36
+ toolCallId: string;
37
+ approved: boolean;
38
+ }, void, "session" | "rpc">;
39
+ export declare const agentApprove: <Name extends keyof AgentMap>(agentName: Name) => PikkuFunctionConfig<{
40
+ runId: string;
41
+ approvals: {
42
+ toolCallId: string;
43
+ approved: boolean;
44
+ }[];
45
+ }, unknown, "session" | "rpc">;
46
+ export {};
47
+ //# sourceMappingURL=pikku-agent-types.gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pikku-agent-types.gen.d.ts","sourceRoot":"","sources":["../../../.pikku/agent/pikku-agent-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,WAAW,EACX,sBAAsB,EACvB,MAAM,sBAAsB,CAAA;AAO7B,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAC9H,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE1D,KAAK,aAAa,CAChB,WAAW,SAAS,gBAAgB,GAAG,SAAS,GAAG,SAAS,EAC5D,YAAY,SAAS,gBAAgB,GAAG,SAAS,GAAG,SAAS,IAC3D,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,eAAe,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC,GAAG;IAC5G,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,GAAG;QAAE,aAAa,CAAC,EAAE,gBAAgB,CAAA;KAAE,CAAA;IAC1F,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC,gBAAgB,GAAG,SAAS,EAAE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;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,EACxD,IAAI,EACJ,SAAS,GAAG,KAAK,CAEpB,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,IAAI,SAAS,MAAM,QAAQ,EACtD,WAAW,IAAI,KAE4D,mBAAmB,CAC5F;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CAAE,EACzE,OAAO,EACP,SAAS,GAAG,KAAK,CAEpB,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { agent as coreAgent, agentStream as coreAgentStream, agentResume as coreAgentResume, agentApprove as coreAgentApprove, } from '@pikku/core/ai-agent';
2
+ export const pikkuAIAgent = (agent) => {
3
+ return agent;
4
+ };
5
+ export const pikkuAIMiddleware = (hooks) => hooks;
6
+ export const agent = (agentName) => {
7
+ return coreAgent(agentName);
8
+ };
9
+ export const agentStream = (agentName) => {
10
+ return coreAgentStream(agentName);
11
+ };
12
+ export const agentResume = () => {
13
+ return coreAgentResume();
14
+ };
15
+ export const agentApprove = (agentName) => {
16
+ return coreAgentApprove(agentName);
17
+ };
18
+ //# sourceMappingURL=pikku-agent-types.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pikku-agent-types.gen.js","sourceRoot":"","sources":["../../../.pikku/agent/pikku-agent-types.gen.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,IAAI,SAAS,EAClB,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,YAAY,IAAI,gBAAgB,GACjC,MAAM,sBAAsB,CAAA;AAiB7B,MAAM,CAAC,MAAM,YAAY,GAAG,CAI1B,KAA+C,EAC/C,EAAE;IACF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAI/B,KAAsD,EACL,EAAE,CAAC,KAAK,CAAA;AAE3D,MAAM,CAAC,MAAM,KAAK,GAAG,CACnB,SAAe,EACf,EAAE;IACF,OAAO,SAAS,CAAW,SAAoC,CAI9D,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,SAAgB,EAChB,EAAE;IACF,OAAO,eAAe,CAAW,SAAoC,CAIpE,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO,eAAe,EAIrB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,SAAe,EACf,EAAE;IACF,OAAO,gBAAgB,CAAW,SAAoC,CAIrE,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ import {
5
+ CoreAIAgent,
6
+ PikkuAIMiddlewareHooks,
7
+ } from '@pikku/core/ai-agent'
8
+ import {
9
+ agent as coreAgent,
10
+ agentStream as coreAgentStream,
11
+ agentResume as coreAgentResume,
12
+ agentApprove as coreAgentApprove,
13
+ } from '@pikku/core/ai-agent'
14
+ import type { PikkuPermission, PikkuMiddleware, Services, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js'
15
+ import type { StandardSchemaV1 } from '@standard-schema/spec'
16
+ import type { AIAgentMemoryConfig, AIAgentInput } from '@pikku/core/ai-agent'
17
+ import type { AgentMap } from './pikku-agent-map.gen.d.js'
18
+
19
+ type AIAgentConfig<
20
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
21
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
22
+ > = Omit<CoreAIAgent<PikkuPermission, PikkuMiddleware>, 'tools' | 'agents' | 'memory' | 'input' | 'output'> & {
23
+ input?: InputSchema
24
+ output?: OutputSchema
25
+ memory?: Omit<AIAgentMemoryConfig, 'workingMemory'> & { workingMemory?: StandardSchemaV1 }
26
+ tools?: object[]
27
+ agents?: AIAgentConfig<StandardSchemaV1 | undefined, StandardSchemaV1 | undefined>[]
28
+ }
29
+
30
+ export const pikkuAIAgent = <
31
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
32
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
33
+ >(
34
+ agent: AIAgentConfig<InputSchema, OutputSchema>
35
+ ) => {
36
+ return agent
37
+ }
38
+
39
+ export const pikkuAIMiddleware = <
40
+ State extends Record<string, unknown> = Record<string, unknown>,
41
+ RequiredServices extends Services = Services,
42
+ >(
43
+ hooks: PikkuAIMiddlewareHooks<State, RequiredServices>
44
+ ): PikkuAIMiddlewareHooks<State, RequiredServices> => hooks
45
+
46
+ export const agent = <Name extends keyof AgentMap>(
47
+ agentName: Name
48
+ ) => {
49
+ return coreAgent<AgentMap>(agentName as string & keyof AgentMap) as PikkuFunctionConfig<
50
+ AIAgentInput,
51
+ { runId: string; result: AgentMap[Name]['output']; usage: { inputTokens: number; outputTokens: number } },
52
+ 'session' | 'rpc'
53
+ >
54
+ }
55
+
56
+ export const agentStream = <Name extends keyof AgentMap>(
57
+ agentName?: Name
58
+ ) => {
59
+ return coreAgentStream<AgentMap>(agentName as string & keyof AgentMap) as PikkuFunctionConfig<
60
+ { agentName?: string; message: string; threadId: string; resourceId: string },
61
+ void,
62
+ 'session' | 'rpc'
63
+ >
64
+ }
65
+
66
+ export const agentResume = () => {
67
+ return coreAgentResume() as PikkuFunctionConfig<
68
+ { runId: string; toolCallId: string; approved: boolean },
69
+ void,
70
+ 'session' | 'rpc'
71
+ >
72
+ }
73
+
74
+ export const agentApprove = <Name extends keyof AgentMap>(
75
+ agentName: Name
76
+ ) => {
77
+ return coreAgentApprove<AgentMap>(agentName as string & keyof AgentMap) as PikkuFunctionConfig<
78
+ { runId: string; approvals: { toolCallId: string; approved: boolean }[] },
79
+ unknown,
80
+ 'session' | 'rpc'
81
+ >
82
+ }