@pikku/addon-ollama 0.1.0 → 0.1.2

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 (177) hide show
  1. package/.pikku/addon/pikku-addon-types.gen.ts +31 -4
  2. package/.pikku/addon/pikku-package.gen.ts +3 -1
  3. package/.pikku/agent/pikku-agent-map.gen.d.ts +2 -14
  4. package/.pikku/agent/pikku-agent-types.gen.ts +13 -7
  5. package/.pikku/channel/pikku-channel-types.gen.ts +177 -0
  6. package/.pikku/console/pikku-addon-meta.gen.json +58 -0
  7. package/.pikku/console/pikku-node-types.gen.ts +1 -1
  8. package/.pikku/function/pikku-function-types.gen.ts +209 -103
  9. package/.pikku/function/pikku-functions-meta-verbose.gen.json +56 -44
  10. package/.pikku/function/pikku-functions-meta.gen.json +42 -38
  11. package/.pikku/function/pikku-functions-meta.gen.ts +1 -1
  12. package/.pikku/function/pikku-functions.gen.ts +2 -2
  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 +2 -9
  16. package/.pikku/pikku-meta-service.gen.ts +10 -0
  17. package/.pikku/pikku-services.gen.ts +14 -2
  18. package/.pikku/pikku-types.gen.ts +1 -1
  19. package/.pikku/queue/pikku-queue-types.gen.ts +27 -0
  20. package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +81 -62
  21. package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +84 -65
  22. package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +6 -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 +17 -17
  26. package/.pikku/secrets/pikku-secret-types.gen.ts +1 -1
  27. package/.pikku/secrets/pikku-secrets.gen.ts +1 -1
  28. package/.pikku/trigger/pikku-trigger-types.gen.ts +1 -1
  29. package/.pikku/variables/pikku-variable-types.gen.ts +1 -1
  30. package/.pikku/variables/pikku-variables-meta.gen.json +1 -1
  31. package/.pikku/variables/pikku-variables.gen.ts +1 -1
  32. package/.pikku/workflow/pikku-workflow-map.gen.d.ts +9 -5
  33. package/.pikku/workflow/pikku-workflow-types.gen.ts +66 -57
  34. package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +1 -1
  35. package/.pikku/workflow/pikku-workflow-wirings.gen.ts +1 -1
  36. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +19 -3
  37. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -1
  38. package/dist/.pikku/addon/pikku-addon-types.gen.js +26 -3
  39. package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -1
  40. package/dist/.pikku/addon/pikku-addon-types.gen.ts +31 -4
  41. package/dist/.pikku/addon/pikku-package.gen.js +2 -1
  42. package/dist/.pikku/addon/pikku-package.gen.js.map +1 -1
  43. package/dist/.pikku/addon/pikku-package.gen.ts +3 -1
  44. package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +2 -14
  45. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +6 -6
  46. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -1
  47. package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -1
  48. package/dist/.pikku/agent/pikku-agent-types.gen.ts +13 -7
  49. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +112 -0
  50. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts.map +1 -0
  51. package/dist/.pikku/channel/pikku-channel-types.gen.js +60 -0
  52. package/dist/.pikku/channel/pikku-channel-types.gen.js.map +1 -0
  53. package/dist/.pikku/channel/pikku-channel-types.gen.ts +177 -0
  54. package/dist/.pikku/console/pikku-addon-meta.gen.json +58 -0
  55. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  56. package/dist/.pikku/console/pikku-node-types.gen.ts +1 -1
  57. package/dist/.pikku/function/pikku-function-types.gen.d.ts +97 -84
  58. package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -1
  59. package/dist/.pikku/function/pikku-function-types.gen.js +96 -60
  60. package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -1
  61. package/dist/.pikku/function/pikku-function-types.gen.ts +209 -103
  62. package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +56 -44
  63. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  64. package/dist/.pikku/function/pikku-functions-meta.gen.json +42 -38
  65. package/dist/.pikku/function/pikku-functions-meta.gen.ts +1 -1
  66. package/dist/.pikku/function/pikku-functions.gen.js +2 -2
  67. package/dist/.pikku/function/pikku-functions.gen.js.map +1 -1
  68. package/dist/.pikku/function/pikku-functions.gen.ts +2 -2
  69. package/dist/.pikku/http/pikku-http-types.gen.d.ts +120 -0
  70. package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -0
  71. package/dist/.pikku/http/pikku-http-types.gen.js +72 -0
  72. package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -0
  73. package/dist/.pikku/http/pikku-http-types.gen.ts +147 -0
  74. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +131 -0
  75. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts.map +1 -0
  76. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +38 -0
  77. package/dist/.pikku/mcp/pikku-mcp-types.gen.js.map +1 -0
  78. package/dist/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
  79. package/dist/.pikku/pikku-bootstrap.gen.d.ts +4 -2
  80. package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -1
  81. package/dist/.pikku/pikku-bootstrap.gen.js +2 -10
  82. package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -1
  83. package/dist/.pikku/pikku-bootstrap.gen.ts +2 -9
  84. package/dist/.pikku/pikku-meta-service.gen.d.ts +8 -0
  85. package/dist/.pikku/pikku-meta-service.gen.d.ts.map +1 -0
  86. package/dist/.pikku/pikku-meta-service.gen.js +10 -0
  87. package/dist/.pikku/pikku-meta-service.gen.js.map +1 -0
  88. package/dist/.pikku/pikku-meta-service.gen.ts +10 -0
  89. package/dist/.pikku/pikku-services.gen.d.ts +12 -2
  90. package/dist/.pikku/pikku-services.gen.d.ts.map +1 -1
  91. package/dist/.pikku/pikku-services.gen.js +11 -0
  92. package/dist/.pikku/pikku-services.gen.js.map +1 -1
  93. package/dist/.pikku/pikku-services.gen.ts +14 -2
  94. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  95. package/dist/.pikku/pikku-types.gen.js +1 -1
  96. package/dist/.pikku/pikku-types.gen.ts +1 -1
  97. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +24 -0
  98. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts.map +1 -0
  99. package/dist/.pikku/queue/pikku-queue-types.gen.js +17 -0
  100. package/dist/.pikku/queue/pikku-queue-types.gen.js.map +1 -0
  101. package/dist/.pikku/queue/pikku-queue-types.gen.ts +27 -0
  102. package/dist/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +81 -62
  103. package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +84 -65
  104. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +2 -0
  105. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts.map +1 -0
  106. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +7 -0
  107. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js.map +1 -0
  108. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +6 -0
  109. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
  110. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +22 -0
  111. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts.map +1 -0
  112. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +17 -0
  113. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js.map +1 -0
  114. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
  115. package/dist/.pikku/schemas/register.gen.js +11 -11
  116. package/dist/.pikku/schemas/register.gen.js.map +1 -1
  117. package/dist/.pikku/schemas/register.gen.ts +17 -17
  118. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  119. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  120. package/dist/.pikku/secrets/pikku-secret-types.gen.ts +1 -1
  121. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  122. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  123. package/dist/.pikku/secrets/pikku-secrets.gen.ts +1 -1
  124. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  125. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  126. package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +1 -1
  127. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  128. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  129. package/dist/.pikku/variables/pikku-variable-types.gen.ts +1 -1
  130. package/dist/.pikku/variables/pikku-variables-meta.gen.json +1 -1
  131. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  132. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  133. package/dist/.pikku/variables/pikku-variables.gen.ts +1 -1
  134. package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +9 -5
  135. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +36 -27
  136. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -1
  137. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +5 -18
  138. package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -1
  139. package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +66 -57
  140. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  141. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +1 -1
  142. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
  143. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  144. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +1 -1
  145. package/dist/src/functions/embeddings/embed-many.function.d.ts +3 -0
  146. package/dist/src/functions/embeddings/embed-many.function.d.ts.map +1 -1
  147. package/dist/src/functions/embeddings/embed-many.function.js +1 -1
  148. package/dist/src/functions/embeddings/embed-many.function.js.map +1 -1
  149. package/dist/src/functions/embeddings/embed.function.d.ts +3 -0
  150. package/dist/src/functions/embeddings/embed.function.d.ts.map +1 -1
  151. package/dist/src/functions/embeddings/embed.function.js +1 -1
  152. package/dist/src/functions/embeddings/embed.function.js.map +1 -1
  153. package/dist/src/functions/text/generate-object.function.d.ts +17 -4
  154. package/dist/src/functions/text/generate-object.function.d.ts.map +1 -1
  155. package/dist/src/functions/text/generate-object.function.js +2 -2
  156. package/dist/src/functions/text/generate-object.function.js.map +1 -1
  157. package/dist/src/functions/text/generate.function.d.ts +13 -0
  158. package/dist/src/functions/text/generate.function.d.ts.map +1 -1
  159. package/dist/src/functions/text/generate.function.js +2 -2
  160. package/dist/src/functions/text/generate.function.js.map +1 -1
  161. package/package.json +8 -8
  162. package/.pikku/agent/pikku-agent-wirings-meta.gen.json +0 -3
  163. package/.pikku/agent/pikku-agent-wirings-meta.gen.ts +0 -7
  164. package/.pikku/agent/pikku-agent-wirings.gen.ts +0 -3
  165. package/.pikku/console/pikku-nodes-meta.gen.json +0 -57
  166. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts +0 -2
  167. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts.map +0 -1
  168. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +0 -7
  169. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js.map +0 -1
  170. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.json +0 -3
  171. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.ts +0 -7
  172. package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +0 -5
  173. package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts.map +0 -1
  174. package/dist/.pikku/agent/pikku-agent-wirings.gen.js +0 -5
  175. package/dist/.pikku/agent/pikku-agent-wirings.gen.js.map +0 -1
  176. package/dist/.pikku/agent/pikku-agent-wirings.gen.ts +0 -3
  177. package/dist/.pikku/console/pikku-nodes-meta.gen.json +0 -57
@@ -1,11 +1,11 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.55
3
3
  */
4
4
  /**
5
5
  * Addon package types for pikkuAddonConfig and pikkuAddonServices
6
6
  */
7
7
 
8
- import type { CreateConfig } from '@pikku/core'
8
+ import type { CreateConfig, PikkuWire } from '@pikku/core'
9
9
  import type { SingletonServices } from '../../types/application-types.d.js'
10
10
  import type { Config } from '../../types/application-types.d.js'
11
11
  import type { RequiredSingletonServices } from '../pikku-services.gen.js'
@@ -15,6 +15,7 @@ import { TypedVariablesService } from '../variables/pikku-variables.gen.js'
15
15
 
16
16
 
17
17
 
18
+
18
19
  /**
19
20
  * Base services provided to addon package service factories.
20
21
  * These are always available from the parent application.
@@ -53,7 +54,7 @@ export const pikkuAddonConfig = <ExistingServices extends Omit<Partial<Singleton
53
54
  * config,
54
55
  * { secrets }
55
56
  * ) => {
56
- * const creds = await secrets.getSecretJSON<GithubCredentials>('GITHUB_CREDENTIALS')
57
+ * const creds = await secrets.getSecret<GithubCredentials>('GITHUB_CREDENTIALS')
57
58
  * const github = new GithubService(creds)
58
59
  * return { github }
59
60
  * })
@@ -63,16 +64,42 @@ export const pikkuAddonServices = <T extends Record<string, any>, ExistingServic
63
64
  func: (config: Config, services: ExistingServices) => Promise<T>
64
65
  ) => {
65
66
  return async (config: Config, existingServices?: Partial<SingletonServices>): Promise<RequiredSingletonServices> => {
66
- const { logger, variables, secrets } = (existingServices ?? {}) as unknown as SingletonServices
67
+ const { logger, variables, secrets, schema } = (existingServices ?? {}) as unknown as SingletonServices
67
68
  const typedVariables = new TypedVariablesService(variables)
68
69
  const typedSecrets = new TypedSecretService(secrets)
69
70
  const result = await func(config, { ...existingServices, logger, variables: typedVariables, secrets: typedSecrets } as ExistingServices)
70
71
  return {
71
72
  config,
72
73
  logger,
74
+ schema,
73
75
  variables: typedVariables,
74
76
  secrets: typedSecrets,
75
77
  ...result,
76
78
  } as unknown as RequiredSingletonServices
77
79
  }
78
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
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.55
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal'
5
5
  import { createSingletonServices as createSingletonServices } from '../../src/services.js'
@@ -7,3 +7,5 @@ import { createSingletonServices as createSingletonServices } from '../../src/se
7
7
  pikkuState('@pikku/addon-ollama', 'package', 'factories', {
8
8
  createSingletonServices,
9
9
  })
10
+
11
+ pikkuState('@pikku/addon-ollama', 'package', 'requiredParentServices', ["variables"])
@@ -1,16 +1,4 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.55
3
3
  */
4
- /**
5
- * Agent type map with output types for each agent
6
- */
7
-
8
-
9
-
10
-
11
- interface AgentHandler<O> {
12
- output: O;
13
- }
14
-
15
- export type AgentMap = {
16
- };
4
+ export type AgentMap = {}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.55
3
3
  */
4
4
  import {
5
5
  CoreAIAgent,
@@ -16,16 +16,22 @@ import type { StandardSchemaV1 } from '@standard-schema/spec'
16
16
  import type { AIAgentMemoryConfig, AIAgentInput } from '@pikku/core/ai-agent'
17
17
  import type { AgentMap } from './pikku-agent-map.gen.d.js'
18
18
 
19
- type AIAgentConfig = Omit<CoreAIAgent<PikkuPermission, PikkuMiddleware>, 'tools' | 'agents' | 'memory'> & {
20
- input?: StandardSchemaV1
21
- output?: StandardSchemaV1
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
22
25
  memory?: Omit<AIAgentMemoryConfig, 'workingMemory'> & { workingMemory?: StandardSchemaV1 }
23
26
  tools?: object[]
24
- agents?: AIAgentConfig[]
27
+ agents?: AIAgentConfig<StandardSchemaV1 | undefined, StandardSchemaV1 | undefined>[]
25
28
  }
26
29
 
27
- export const pikkuAIAgent = (
28
- agent: AIAgentConfig
30
+ export const pikkuAIAgent = <
31
+ InputSchema extends StandardSchemaV1 | undefined = undefined,
32
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
33
+ >(
34
+ agent: AIAgentConfig<InputSchema, OutputSchema>
29
35
  ) => {
30
36
  return agent
31
37
  }
@@ -0,0 +1,177 @@
1
+ /**
2
+ * This file was generated by @pikku/cli@0.12.55
3
+ */
4
+ /**
5
+ * Channel-specific type definitions for tree-shaking optimization
6
+ */
7
+
8
+ import { CoreChannel, CorePikkuChannelMiddleware, CorePikkuChannelMiddlewareFactory, wireChannel as wireChannelCore, defineChannelRoutes as defineChannelRoutesCore, addChannelMiddleware as addChannelMiddlewareCore } from '@pikku/core/channel'
9
+ import { AssertHTTPWiringParams } from '@pikku/core/http'
10
+ import type { PikkuFunctionConfig, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware, Services } from '../function/pikku-function-types.gen.js'
11
+ import type { CorePermissionGroup } from '@pikku/core'
12
+ import type { StandardSchemaV1 } from '@standard-schema/spec'
13
+
14
+ /**
15
+ * Helper type to infer the output type from a Standard Schema
16
+ */
17
+ type InferSchemaOutput<T> = T extends StandardSchemaV1<any, infer Output> ? Output : never
18
+
19
+ /**
20
+ * Type definition for WebSocket channels with typed data exchange.
21
+ * Supports connection, disconnection, and message handling.
22
+ * Accepts both session-based (PikkuFunction) and sessionless (PikkuFunctionSessionless) functions.
23
+ *
24
+ * @template ChannelData - Type of data exchanged through the channel
25
+ * @template Channel - String literal type for the channel name
26
+ */
27
+ type ChannelWiring<ChannelData, Channel extends string> = CoreChannel<
28
+ ChannelData,
29
+ Channel,
30
+ PikkuFunctionConfig<void, any, 'channel' | 'session' | 'rpc'>,
31
+ PikkuFunctionConfig<void, void, 'channel' | 'session' | 'rpc'>,
32
+ PikkuFunctionConfig<any, any, 'channel' | 'session' | 'rpc'>,
33
+ PikkuPermission,
34
+ PikkuMiddleware
35
+ >
36
+
37
+ /**
38
+ * Creates a function that handles WebSocket channel connections.
39
+ * Called when a client connects to a channel.
40
+ *
41
+ * @template Out - Output type for connection response
42
+ * @param func - Function definition, either direct function or configuration object
43
+ * @returns The normalized configuration object
44
+ */
45
+ export const pikkuChannelConnectionFunc = <Out = unknown>(
46
+ func:
47
+ | PikkuFunctionSessionless<void, Out, 'channel' | 'session' | 'rpc'>
48
+ | PikkuFunctionConfig<void, Out, 'channel' | 'session' | 'rpc'>
49
+ ) => {
50
+ return typeof func === 'function' ? { func } : func
51
+ }
52
+
53
+ /**
54
+ * Creates a function that handles WebSocket channel disconnections.
55
+ * Called when a client disconnects from a channel.
56
+ *
57
+ * @param func - Function definition, either direct function or configuration object
58
+ * @returns The normalized configuration object
59
+ */
60
+ export const pikkuChannelDisconnectionFunc = (
61
+ func:
62
+ | PikkuFunctionSessionless<void, void, 'channel'>
63
+ | PikkuFunctionConfig<void, void, 'channel' | 'session' | 'rpc'>
64
+ ) => {
65
+ return typeof func === 'function' ? { func } : func
66
+ }
67
+
68
+ /**
69
+ * Configuration object for channel functions with Zod schema validation.
70
+ */
71
+ type PikkuChannelFuncConfigWithSchema<
72
+ InputSchema extends StandardSchemaV1,
73
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
74
+ > = {
75
+ name?: string
76
+ tags?: string[]
77
+ expose?: boolean
78
+ remote?: boolean
79
+ func: PikkuFunctionSessionless<
80
+ InferSchemaOutput<InputSchema>,
81
+ OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
82
+ 'channel' | 'session' | 'rpc'
83
+ >
84
+ auth?: boolean
85
+ permissions?: CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
86
+ middleware?: PikkuMiddleware[]
87
+ input: InputSchema
88
+ output?: OutputSchema
89
+ }
90
+
91
+ /**
92
+ * Creates a function that handles WebSocket channel messages.
93
+ * Called when a message is received on a channel.
94
+ *
95
+ * Supports two patterns:
96
+ * 1. Generic types: `pikkuChannelFunc<Input, Output>({ func: ... })`
97
+ * 2. Zod schemas: `pikkuChannelFunc({ input: z.object(...), func: ... })`
98
+ *
99
+ * @template In - Input type for channel messages (inferred from schema if provided)
100
+ * @template Out - Output type for channel responses (inferred from schema if provided)
101
+ * @param func - Function definition, either direct function or configuration object
102
+ * @returns The normalized configuration object
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * // Pattern 1: Using generic types
107
+ * const handleMessage = pikkuChannelFunc<{text: string}, {received: boolean}>({
108
+ * func: async (_services, { text }) => ({ received: true })
109
+ * })
110
+ *
111
+ * // Pattern 2: Using Zod schemas
112
+ * const messageInput = z.object({ text: z.string() })
113
+ * const messageOutput = z.object({ received: z.boolean() })
114
+ *
115
+ * const handleMessage = pikkuChannelFunc({
116
+ * input: messageInput,
117
+ * output: messageOutput,
118
+ * func: async (_services, { text }) => ({ received: true })
119
+ * })
120
+ * ```
121
+ */
122
+ export function pikkuChannelFunc<
123
+ InputSchema extends StandardSchemaV1,
124
+ OutputSchema extends StandardSchemaV1 | undefined = undefined
125
+ >(
126
+ config: PikkuChannelFuncConfigWithSchema<InputSchema, OutputSchema>
127
+ ): PikkuFunctionConfig<InferSchemaOutput<InputSchema>, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'channel' | 'session' | 'rpc'>
128
+ export function pikkuChannelFunc<In, Out = unknown>(
129
+ func:
130
+ | PikkuFunctionSessionless<In, Out, 'channel' | 'session' | 'rpc'>
131
+ | PikkuFunctionConfig<In, Out, 'channel' | 'session' | 'rpc'>
132
+ ): PikkuFunctionConfig<In, Out, 'channel' | 'session' | 'rpc'>
133
+ export function pikkuChannelFunc(func: any) {
134
+ return typeof func === 'function' ? { func } : func
135
+ }
136
+
137
+ /**
138
+ * Registers a WebSocket channel with the Pikku framework.
139
+ *
140
+ * @template ChannelData - Type of data associated with the channel
141
+ * @template Channel - String literal type for the channel name
142
+ * @param channel - Channel definition with connection, disconnection, and message handlers
143
+ */
144
+ export const wireChannel = <ChannelData, Channel extends string>(
145
+ channel: ChannelWiring<ChannelData, Channel> & AssertHTTPWiringParams<ChannelData, Channel>
146
+ ) => {
147
+ wireChannelCore(channel as any)
148
+ }
149
+
150
+ /**
151
+ * Type-safe helper for defining channel message routes that can be composed.
152
+ * Returns the routes record as-is for use with wireChannel's onMessageWiring.
153
+ *
154
+ * @template T - Record of channel route handlers
155
+ * @param routes - The channel routes record
156
+ * @returns The same routes record (identity function for type safety)
157
+ */
158
+ export function defineChannelRoutes<T extends Record<string, any>>(routes: T): T {
159
+ return defineChannelRoutesCore(routes)
160
+ }
161
+
162
+ export type PikkuChannelMiddleware<RequiredServices extends Services = Services, Event = unknown> = CorePikkuChannelMiddleware<RequiredServices, Event>
163
+
164
+ export const pikkuChannelMiddleware = <RequiredServices extends Services = Services, Event = unknown>(
165
+ middleware: PikkuChannelMiddleware<RequiredServices, Event>
166
+ ): PikkuChannelMiddleware<RequiredServices, Event> => {
167
+ return middleware
168
+ }
169
+
170
+ export const pikkuChannelMiddlewareFactory = <In = any>(
171
+ factory: CorePikkuChannelMiddlewareFactory<In>
172
+ ): CorePikkuChannelMiddlewareFactory<In> => {
173
+ return factory
174
+ }
175
+
176
+ export const addChannelMiddleware = (tag: string, middleware: PikkuChannelMiddleware[]) =>
177
+ addChannelMiddlewareCore(tag, middleware, '@pikku/addon-ollama')
@@ -0,0 +1,58 @@
1
+ {
2
+ "nodes": {
3
+ "ollamaEmbedMany": {
4
+ "name": "ollamaEmbedMany",
5
+ "displayName": "Embed Multiple Texts",
6
+ "category": "Embeddings",
7
+ "type": "action",
8
+ "rpc": "ollamaEmbedMany",
9
+ "description": "Create embedding vectors from multiple texts using an Ollama model",
10
+ "errorOutput": false,
11
+ "inputSchemaName": "OllamaEmbedManyInput",
12
+ "outputSchemaName": "OllamaEmbedManyOutput"
13
+ },
14
+ "ollamaEmbed": {
15
+ "name": "ollamaEmbed",
16
+ "displayName": "Embed Text",
17
+ "category": "Embeddings",
18
+ "type": "action",
19
+ "rpc": "ollamaEmbed",
20
+ "description": "Create an embedding vector from text using an Ollama model",
21
+ "errorOutput": false,
22
+ "inputSchemaName": "OllamaEmbedInput",
23
+ "outputSchemaName": "OllamaEmbedOutput"
24
+ },
25
+ "ollamaGenerateObject": {
26
+ "name": "ollamaGenerateObject",
27
+ "displayName": "Generate Object",
28
+ "category": "Text",
29
+ "type": "action",
30
+ "rpc": "ollamaGenerateObject",
31
+ "description": "Generate a structured JSON object using an Ollama model",
32
+ "errorOutput": false,
33
+ "inputSchemaName": "OllamaGenerateObjectInput",
34
+ "outputSchemaName": "OllamaGenerateObjectOutput"
35
+ },
36
+ "ollamaGenerateText": {
37
+ "name": "ollamaGenerateText",
38
+ "displayName": "Generate Text",
39
+ "category": "Text",
40
+ "type": "action",
41
+ "rpc": "ollamaGenerateText",
42
+ "description": "Generate text using an Ollama model",
43
+ "errorOutput": false,
44
+ "inputSchemaName": "OllamaGenerateTextInput",
45
+ "outputSchemaName": "OllamaGenerateTextOutput"
46
+ }
47
+ },
48
+ "secrets": {},
49
+ "package": {
50
+ "displayName": "Ollama",
51
+ "description": "Run large language models locally",
52
+ "icon": "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"241.333\" height=\"341.333\" version=\"1.0\" viewBox=\"0 0 181 256\"><g fill=\"#7D7D87\"><path d=\"M37.7 19.5c-5.2 1.8-8.3 4.9-11.7 11.6-4.5 8.9-6.2 19.2-5.8 35.5l.3 14.2-5.8 6.1c-14.8 15.5-18.5 38.7-9.2 57.4l3.4 6.9-2 4.4c-3.4 8.2-5 16.4-5 26.3 0 10.8 1.8 19 5.8 26.2l2.6 4.8-2.1 4.9c-1.2 2.7-2.6 7.1-3.2 9.8-1.4 6.2-1.5 22.1-.1 25.7 1 2.6 1.4 2.7 7.6 2.7 7.3 0 7 .4 5.3-8.6-1.5-8.2.2-18.8 4.2-26.6 3.7-7 3.8-10.4.5-14.8-4.7-6.4-6.8-13.6-6.9-24-.1-10.3 1.4-16 6.6-26.1 3.1-6.1 2.9-8.7-1-12.2-1.1-1-3.1-4.2-4.3-7-1.9-4.2-2.4-6.9-2.3-14.2 0-11.4 2.5-18.3 9.5-26 7-7.6 14.2-11 23.9-11.2 4.1 0 7.8-.2 8.2-.2.4-.1 1.7-2.2 2.9-4.7 3-5.9 9.6-11.9 16.7-15.2 4.9-2.3 7-2.7 14.7-2.7 7.9 0 9.7.4 14.9 2.9 6.8 3.3 13.3 9.4 15.9 14.8 1 2 2.3 4.1 3 4.5.6.4 4.6.8 8.7.8 6.7.1 8.3.5 14 3.6 12.3 6.8 19.3 18.7 19.3 33.4.1 6.7-.4 9-2.7 14.2-1.6 3.5-3.5 6.8-4.3 7.5-3.4 2.8-3.5 5.8-.5 11.7 5.2 10.1 6.7 15.8 6.6 26.1-.1 10.4-2.2 17.6-6.9 24-3.3 4.4-3.2 7.8.5 14.8 4 7.8 5.7 18.4 4.2 26.6-1.7 9-2 8.6 5.3 8.6 6.2 0 6.6-.1 7.6-2.7 1.4-3.6 1.3-19.5-.1-25.7-.6-2.7-2-7.1-3.2-9.8l-2.1-4.9 2.6-4.8c7.6-13.9 7.9-35.9.6-52.8l-2-4.7 2.5-4.6c9.9-18.3 6.4-43.9-8.1-59.1l-5.8-6.1.3-14.2c.4-16.4-1.3-26.6-5.8-35.7-6.4-12.6-17.2-15.9-26.3-7.9-5.4 4.7-9.2 13.8-12.3 29.8-.3 1.4-1 2.2-1.7 1.8-18.2-8-29.7-8.5-44.3-2.1L65 54.9l-.4-2.2C61 34.2 56.1 24.2 49 20.5c-4.3-2.1-7.4-2.4-11.3-1m7.7 16.8c4.2 7.1 8.1 30.1 5.7 33.6-.5.8-3.1 1.6-5.8 1.8-2.6.2-6.2.8-8 1.3l-3.1.8-.7-4.9c-.8-5.9.2-17.2 2.2-24.8C37.1 38.4 40.5 32 42 32c.5 0 2 1.9 3.4 4.3m96.5-1c4 6.5 6.9 23.9 5.6 33.6l-.7 4.9-3.1-.8c-1.8-.5-5.4-1.1-8-1.3-2.7-.2-5.3-1-5.8-1.8-1.2-1.7-.3-14.1 1.7-22.9 1.5-6.4 5.7-15 7.4-15 .4 0 1.8 1.5 2.9 3.3\"/><path d=\"M77.8 119.9c-7.3 2.4-11.6 5.1-16.5 10.4-5.5 6-7.6 12-7.1 20.1.5 7.6 3.5 12.9 10.6 18.3 6.2 4.7 12.7 6.3 25.7 6.3 17.2 0 25.8-3.6 32.9-13.8 4.2-5.9 4.8-15.5 1.6-23-2.9-6.8-11.1-14.3-18.8-17.3-8-3.1-20.7-3.6-28.4-1m25.7 10c16.1 7.1 19.4 23.2 6.6 31.8-4.9 3.3-9.4 4.3-19.6 4.3s-14.7-1-19.6-4.3c-17.8-12-3.2-35.6 21.1-34.3 3.9.2 8.6 1.2 11.5 2.5\"/><path d=\"M83.8 140.1c-2.5 1.4-2.2 4.4.7 6.7 2 1.6 2.4 2.6 1.9 4.9-.7 3.6 1.5 5.8 5.1 4.9 2.1-.5 2.5-1.2 2.5-4.6 0-2.9.5-4.2 2-5 2.7-1.5 2.7-6.6 0-7.5-1-.3-2.8-.1-4 .5-1.4.7-2.6.8-3.9 0-2.3-1.2-2.2-1.2-4.3.1m-44.1-18.9c-.9.7-2.3 3-3.2 5-2.1 5.3-.1 10.3 4.7 11.6 4.3 1.1 6 .6 9.2-2.7 4-4.1 4.3-8.1 1.1-11.9-2.1-2.5-3.4-3.2-6.4-3.2-2 0-4.5.6-5.4 1.2m89.8 2c-3.2 3.8-2.9 7.8 1.1 11.9 3.2 3.3 4.9 3.8 9.2 2.7 4.9-1.3 6.8-6.2 4.6-11.8-1.9-4.7-3.8-6-8.7-6-2.7 0-4.1.7-6.2 3.2\"/></g></svg>",
53
+ "categories": [
54
+ "Text",
55
+ "Embeddings"
56
+ ]
57
+ }
58
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.1
2
+ * This file was generated by @pikku/cli@0.12.55
3
3
  */
4
4
  import type { FlattenedRPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.js'
5
5