@pikku/addon-ollama 0.1.1 → 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 (166) hide show
  1. package/.pikku/addon/pikku-addon-types.gen.ts +105 -0
  2. package/.pikku/addon/pikku-package.gen.ts +11 -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 +58 -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 +118 -0
  10. package/.pikku/function/pikku-functions-meta.gen.json +78 -0
  11. package/.pikku/function/pikku-functions-meta.gen.ts +7 -0
  12. package/.pikku/function/pikku-functions.gen.ts +14 -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 +45 -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 +207 -0
  21. package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +211 -0
  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 +39 -0
  26. package/.pikku/schemas/schemas/OllamaEmbedInput.schema.json +1 -0
  27. package/.pikku/schemas/schemas/OllamaEmbedManyInput.schema.json +1 -0
  28. package/.pikku/schemas/schemas/OllamaEmbedManyOutput.schema.json +1 -0
  29. package/.pikku/schemas/schemas/OllamaEmbedOutput.schema.json +1 -0
  30. package/.pikku/schemas/schemas/OllamaGenerateObjectInput.schema.json +1 -0
  31. package/.pikku/schemas/schemas/OllamaGenerateObjectOutput.schema.json +1 -0
  32. package/.pikku/schemas/schemas/OllamaGenerateTextInput.schema.json +1 -0
  33. package/.pikku/schemas/schemas/OllamaGenerateTextOutput.schema.json +1 -0
  34. package/.pikku/schemas/schemas/VariableSchema_ollama_base_url.schema.json +1 -0
  35. package/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
  36. package/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
  37. package/.pikku/secrets/pikku-secrets.gen.ts +21 -0
  38. package/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
  39. package/.pikku/variables/pikku-variable-types.gen.ts +5 -0
  40. package/.pikku/variables/pikku-variables-meta.gen.json +10 -0
  41. package/.pikku/variables/pikku-variables.gen.ts +23 -0
  42. package/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
  43. package/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
  44. package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
  45. package/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
  46. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +4 -4
  47. package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -1
  48. package/dist/.pikku/addon/pikku-addon-types.gen.js +7 -3
  49. package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -1
  50. package/dist/.pikku/addon/pikku-addon-types.gen.ts +11 -6
  51. package/dist/.pikku/addon/pikku-package.gen.js +2 -1
  52. package/dist/.pikku/addon/pikku-package.gen.js.map +1 -1
  53. package/dist/.pikku/addon/pikku-package.gen.ts +3 -1
  54. package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +2 -14
  55. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +6 -6
  56. package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -1
  57. package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -1
  58. package/dist/.pikku/agent/pikku-agent-types.gen.ts +13 -7
  59. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +112 -0
  60. package/dist/.pikku/channel/pikku-channel-types.gen.d.ts.map +1 -0
  61. package/dist/.pikku/channel/pikku-channel-types.gen.js +60 -0
  62. package/dist/.pikku/channel/pikku-channel-types.gen.js.map +1 -0
  63. package/dist/.pikku/channel/pikku-channel-types.gen.ts +177 -0
  64. package/dist/.pikku/console/pikku-addon-meta.gen.json +27 -27
  65. package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
  66. package/dist/.pikku/console/pikku-node-types.gen.ts +1 -1
  67. package/dist/.pikku/function/pikku-function-types.gen.d.ts +71 -87
  68. package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -1
  69. package/dist/.pikku/function/pikku-function-types.gen.js +80 -60
  70. package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -1
  71. package/dist/.pikku/function/pikku-function-types.gen.ts +170 -102
  72. package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +56 -44
  73. package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
  74. package/dist/.pikku/function/pikku-functions-meta.gen.json +42 -38
  75. package/dist/.pikku/function/pikku-functions-meta.gen.ts +1 -1
  76. package/dist/.pikku/function/pikku-functions.gen.js +2 -2
  77. package/dist/.pikku/function/pikku-functions.gen.js.map +1 -1
  78. package/dist/.pikku/function/pikku-functions.gen.ts +2 -2
  79. package/dist/.pikku/http/pikku-http-types.gen.d.ts +120 -0
  80. package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -0
  81. package/dist/.pikku/http/pikku-http-types.gen.js +72 -0
  82. package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -0
  83. package/dist/.pikku/http/pikku-http-types.gen.ts +147 -0
  84. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +131 -0
  85. package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts.map +1 -0
  86. package/dist/.pikku/mcp/pikku-mcp-types.gen.js +38 -0
  87. package/dist/.pikku/mcp/pikku-mcp-types.gen.js.map +1 -0
  88. package/dist/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
  89. package/dist/.pikku/pikku-bootstrap.gen.d.ts +4 -2
  90. package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -1
  91. package/dist/.pikku/pikku-bootstrap.gen.js +2 -10
  92. package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -1
  93. package/dist/.pikku/pikku-bootstrap.gen.ts +2 -9
  94. package/dist/.pikku/pikku-meta-service.gen.d.ts +8 -0
  95. package/dist/.pikku/pikku-meta-service.gen.d.ts.map +1 -0
  96. package/dist/.pikku/pikku-meta-service.gen.js +10 -0
  97. package/dist/.pikku/pikku-meta-service.gen.js.map +1 -0
  98. package/dist/.pikku/pikku-meta-service.gen.ts +10 -0
  99. package/dist/.pikku/pikku-services.gen.d.ts +10 -2
  100. package/dist/.pikku/pikku-services.gen.d.ts.map +1 -1
  101. package/dist/.pikku/pikku-services.gen.js +9 -0
  102. package/dist/.pikku/pikku-services.gen.js.map +1 -1
  103. package/dist/.pikku/pikku-services.gen.ts +12 -2
  104. package/dist/.pikku/pikku-types.gen.d.ts +1 -1
  105. package/dist/.pikku/pikku-types.gen.js +1 -1
  106. package/dist/.pikku/pikku-types.gen.ts +1 -1
  107. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +24 -0
  108. package/dist/.pikku/queue/pikku-queue-types.gen.d.ts.map +1 -0
  109. package/dist/.pikku/queue/pikku-queue-types.gen.js +17 -0
  110. package/dist/.pikku/queue/pikku-queue-types.gen.js.map +1 -0
  111. package/dist/.pikku/queue/pikku-queue-types.gen.ts +27 -0
  112. package/dist/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +81 -62
  113. package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +84 -65
  114. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +2 -0
  115. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts.map +1 -0
  116. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +7 -0
  117. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js.map +1 -0
  118. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +6 -0
  119. package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
  120. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +22 -0
  121. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts.map +1 -0
  122. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +17 -0
  123. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js.map +1 -0
  124. package/dist/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
  125. package/dist/.pikku/schemas/register.gen.js +11 -11
  126. package/dist/.pikku/schemas/register.gen.js.map +1 -1
  127. package/dist/.pikku/schemas/register.gen.ts +17 -17
  128. package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
  129. package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
  130. package/dist/.pikku/secrets/pikku-secret-types.gen.ts +1 -1
  131. package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
  132. package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
  133. package/dist/.pikku/secrets/pikku-secrets.gen.ts +1 -1
  134. package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
  135. package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
  136. package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +1 -1
  137. package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
  138. package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
  139. package/dist/.pikku/variables/pikku-variable-types.gen.ts +1 -1
  140. package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
  141. package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
  142. package/dist/.pikku/variables/pikku-variables.gen.ts +1 -1
  143. package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +9 -5
  144. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +36 -27
  145. package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -1
  146. package/dist/.pikku/workflow/pikku-workflow-types.gen.js +5 -18
  147. package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -1
  148. package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +66 -57
  149. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
  150. package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +1 -1
  151. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
  152. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
  153. package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +1 -1
  154. package/dist/src/functions/text/generate-object.function.d.ts +4 -4
  155. package/package.json +7 -6
  156. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts +0 -2
  157. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts.map +0 -1
  158. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +0 -7
  159. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js.map +0 -1
  160. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.json +0 -3
  161. package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.ts +0 -7
  162. package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +0 -5
  163. package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts.map +0 -1
  164. package/dist/.pikku/agent/pikku-agent-wirings.gen.js +0 -5
  165. package/dist/.pikku/agent/pikku-agent-wirings.gen.js.map +0 -1
  166. package/dist/.pikku/agent/pikku-agent-wirings.gen.ts +0 -3
@@ -1,14 +1,20 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.6
2
+ * This file was generated by @pikku/cli@0.12.55
3
3
  */
4
4
  /**
5
5
  * Core function, middleware, and permission types for all wirings
6
6
  */
7
7
 
8
- import { CorePikkuFunctionConfig, CorePikkuAuth, CorePikkuAuthConfig, CorePikkuPermission, CorePikkuMiddleware, CorePermissionGroup, addMiddleware as addMiddlewareCore, addPermission as addPermissionCore, PikkuWire, PickRequired } from '@pikku/core'
8
+ import type { CorePikkuMiddleware, CorePermissionGroup, ListInput, ListOutput, PikkuWire, PickRequired } from '@pikku/core'
9
+ import type { CorePikkuFunctionConfig, CorePikkuAuth, CorePikkuAuthConfig, CorePikkuPermission } from '@pikku/core/function'
10
+ import { pikkuAuth as pikkuAuthCore } from '@pikku/core/function'
11
+ import {
12
+ addTagMiddleware as addTagMiddlewareCore,
13
+ addGlobalMiddleware as addGlobalMiddlewareCore,
14
+ addTagPermission as addTagPermissionCore,
15
+ addGlobalPermission as addGlobalPermissionCore,
16
+ } from '@pikku/core/middleware'
9
17
  import { pikkuState as __pikkuState, CreateWireServices } from '@pikku/core/internal'
10
- import { pikkuAuth as pikkuAuthCore } from '@pikku/core'
11
- import { PikkuError } from '@pikku/core/errors'
12
18
  import type { NodeType } from '@pikku/core/node'
13
19
  import type { StandardSchemaV1 } from '@standard-schema/spec'
14
20
  import { CorePikkuFunction, CorePikkuFunctionSessionless } from '@pikku/core/function'
@@ -323,34 +329,36 @@ export type PikkuFunctionConfig<
323
329
  * Use this when you want to define input/output schemas using Zod.
324
330
  * Types are automatically inferred from the schemas.
325
331
  */
332
+ type SchemaInferred<S, Fallback = unknown> = S extends StandardSchemaV1
333
+ ? InferSchemaOutput<S>
334
+ : Fallback
335
+
336
+ /**
337
+ * Schema-overload variant for pikkuFunc. Derived from CorePikkuFunctionConfig
338
+ * so adding a field on the core type automatically propagates here.
339
+ */
326
340
  export type PikkuFunctionConfigWithSchema<
327
341
  InputSchema extends StandardSchemaV1 | undefined = undefined,
328
342
  OutputSchema extends StandardSchemaV1 | undefined = undefined,
329
343
  RequiredWires extends keyof PikkuWire = never
330
- > = {
331
- name?: string
332
- tags?: string[]
333
- expose?: boolean
334
- mcp?: boolean
335
- internal?: boolean
336
- approvalRequired?: boolean
337
- approvalDescription?: InputSchema extends StandardSchemaV1 ? PikkuApprovalDescription<InferSchemaOutput<InputSchema>> : never
338
- func: PikkuFunction<
339
- InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
340
- OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
341
- RequiredWires
342
- > | PikkuFunctionSessionless<
343
- InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
344
- OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
345
- RequiredWires
346
- >
347
- auth?: boolean
348
- permissions?: InputSchema extends StandardSchemaV1 ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>> : undefined
349
- middleware?: PikkuMiddleware[]
344
+ > = Omit<
345
+ CorePikkuFunctionConfig<
346
+ | PikkuFunction<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
347
+ | PikkuFunctionSessionless<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
348
+ >,
349
+ 'func' | 'input' | 'output' | 'permissions' | 'approvalDescription'
350
+ > & {
351
+ func:
352
+ | PikkuFunction<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
353
+ | PikkuFunctionSessionless<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
350
354
  input?: InputSchema
351
355
  output?: OutputSchema
352
- node?: NodeConfig
353
- errors?: Array<typeof PikkuError>
356
+ permissions?: InputSchema extends StandardSchemaV1
357
+ ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
358
+ : undefined
359
+ approvalDescription?: InputSchema extends StandardSchemaV1
360
+ ? PikkuApprovalDescription<InferSchemaOutput<InputSchema>>
361
+ : never
354
362
  }
355
363
 
356
364
  /**
@@ -406,35 +414,62 @@ export function pikkuFunc(func: any) {
406
414
  return typeof func === 'function' ? { func } : func
407
415
  }
408
416
 
417
+ export type PikkuListFunction<
418
+ F extends Record<string, unknown> = {},
419
+ Row = unknown,
420
+ S extends string = never
421
+ > =
422
+ | PikkuFunction<ListInput<F, S>, ListOutput<Row>, 'session' | 'rpc'>
423
+ | PikkuFunctionSessionless<
424
+ ListInput<F, S>,
425
+ ListOutput<Row>,
426
+ 'session' | 'rpc'
427
+ >
428
+
429
+ export const pikkuListFunc = <
430
+ F extends Record<string, unknown> = {},
431
+ Row = unknown,
432
+ S extends string = never
433
+ >(
434
+ config: PikkuFunctionConfig<
435
+ ListInput<F, S>,
436
+ ListOutput<Row>,
437
+ 'session' | 'rpc'
438
+ >
439
+ ): PikkuFunctionConfig<ListInput<F, S>, ListOutput<Row>, 'session' | 'rpc'> => {
440
+ return pikkuFunc(config)
441
+ }
442
+
409
443
  /**
410
444
  * Configuration object for sessionless Pikku functions with Zod schema validation.
411
445
  */
446
+ /**
447
+ * Schema-overload variant for pikkuSessionlessFunc. Derived from
448
+ * CorePikkuFunctionConfig to stay in sync with the generic-typed config.
449
+ */
412
450
  export type PikkuFunctionSessionlessConfigWithSchema<
413
451
  InputSchema extends StandardSchemaV1 | undefined = undefined,
414
452
  OutputSchema extends StandardSchemaV1 | undefined = undefined,
415
453
  RequiredWires extends keyof PikkuWire = never
416
- > = {
417
- name?: string
418
- description?: string
419
- tags?: string[]
420
- expose?: boolean
421
- mcp?: boolean
422
- internal?: boolean
423
- remote?: boolean
424
- approvalRequired?: boolean
425
- approvalDescription?: InputSchema extends StandardSchemaV1 ? PikkuApprovalDescription<InferSchemaOutput<InputSchema>> : never
454
+ > = Omit<
455
+ CorePikkuFunctionConfig<
456
+ PikkuFunctionSessionless<SchemaInferred<InputSchema>, SchemaInferred<OutputSchema>, RequiredWires>
457
+ >,
458
+ 'func' | 'input' | 'output' | 'permissions' | 'approvalDescription'
459
+ > & {
426
460
  func: PikkuFunctionSessionless<
427
- InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
428
- OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
461
+ SchemaInferred<InputSchema>,
462
+ SchemaInferred<OutputSchema>,
429
463
  RequiredWires
430
464
  >
431
- auth?: boolean
432
- permissions?: InputSchema extends StandardSchemaV1 ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>> : undefined
433
- middleware?: PikkuMiddleware[]
434
465
  input?: InputSchema
435
466
  output?: OutputSchema
436
- node?: NodeConfig
437
- errors?: Array<typeof PikkuError>
467
+ permissions?: InputSchema extends StandardSchemaV1
468
+ ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
469
+ : undefined
470
+ approvalDescription?: InputSchema extends StandardSchemaV1
471
+ ? PikkuApprovalDescription<InferSchemaOutput<InputSchema>>
472
+ : never
438
473
  }
439
474
 
440
475
  /**
@@ -512,27 +547,23 @@ export const pikkuVoidFunc = (
512
547
  }
513
548
 
514
549
  /**
515
- * Creates a wrapper function for addon package functions that are exposed via RPC.
516
- * This allows you to wire addon functions to any wiring type (HTTP, queue, etc.)
517
- * without type compatibility issues.
550
+ * References a registered function by name for use in any wiring.
551
+ * Works for both local and addon functions — resolves via RPC at runtime.
518
552
  *
519
- * @template Name - The RPC method name (must be a key in FlattenedRPCMap)
520
- * @param rpcName - The name of the RPC method to invoke
521
- * @returns A Pikku function that proxies calls to the addon RPC method
553
+ * @template Name - The function name (must be a key in FlattenedRPCMap)
554
+ * @param rpcName - The name of the function to reference
555
+ * @returns A Pikku function config that proxies calls via RPC
522
556
  *
523
557
  * @example
524
558
  * ```typescript
525
- * // Wire an addon function via HTTP
526
- * wireHTTP({
527
- * auth: false,
528
- * method: 'get',
529
- * route: '/addon/hello',
530
- * func: addon('ext:hello'),
531
- * tags: ['addon'],
532
- * })
559
+ * // Use in agent tools
560
+ * tools: [ref('todos:listTodos'), ref('myLocalFunc')]
561
+ *
562
+ * // Use in HTTP wiring
563
+ * wireHTTP({ route: '/greet', method: 'post', func: ref('greet') })
533
564
  * ```
534
565
  */
535
- export const addon = <Name extends keyof FlattenedRPCMap>(
566
+ export const ref = <Name extends keyof FlattenedRPCMap>(
536
567
  rpcName: Name
537
568
  ): PikkuFunctionConfig<
538
569
  FlattenedRPCMap[Name]['input'],
@@ -591,12 +622,27 @@ export const pikkuConfig = (
591
622
  * ```
592
623
  */
593
624
  export const pikkuServices = (
594
- func: (config: Config, existingServices: Partial<SingletonServices>) => Promise<RequiredSingletonServices>
625
+ func: (config: Config, existingServices: Partial<SingletonServices>) => Promise<Partial<Omit<RequiredSingletonServices, 'auth'>>>
595
626
  ) => {
596
627
  return async (config: Config, existingServices: Partial<SingletonServices> = {}) => {
597
- const services = await func(config, existingServices)
598
- __pikkuState(null, 'package', 'singletonServices', services as any)
599
- return services
628
+ const createdServices = await func(config, existingServices)
629
+ const services = { ...existingServices, ...createdServices }
630
+ const authFactory = __pikkuState(null, 'package', 'authFactory')
631
+ if (authFactory) {
632
+ let authInstance: Promise<unknown> | undefined
633
+ ;(services as any).auth = () => {
634
+ authInstance ??= Promise.resolve()
635
+ .then(() => authFactory(services as any))
636
+ .catch((error) => {
637
+ authInstance = undefined
638
+ throw error
639
+ })
640
+ return authInstance
641
+ }
642
+ }
643
+ const resolved = services as RequiredSingletonServices
644
+ __pikkuState(null, 'package', 'singletonServices', resolved as any)
645
+ return resolved
600
646
  }
601
647
  }
602
648
 
@@ -629,58 +675,80 @@ export const pikkuWireServices = (
629
675
  }
630
676
 
631
677
  /**
632
- * Adds global middleware for a specific tag.
633
- *
634
- * This function allows you to register middleware that will be applied to
635
- * any wiring (HTTP, Channel, Queue, Scheduler, MCP) that includes the matching tag.
636
- *
637
- * @param tag - The tag that the middleware should apply to.
638
- * @param middleware - The middleware array to apply for the specified tag.
639
- *
640
- * @throws Error if middleware for the tag already exists.
678
+ * Tag-scoped middleware. Applies to any wiring that carries the matching tag.
641
679
  *
642
680
  * @example
643
- * ```typescript
644
- * // Add admin middleware for admin endpoints
645
- * addMiddleware('admin', [adminMiddleware])
646
- *
647
- * // Add authentication middleware for auth endpoints
648
- * addMiddleware('auth', [authMiddleware])
649
- *
650
- * // Add logging middleware for all API endpoints
651
- * addMiddleware('api', [loggingMiddleware])
652
- * ```
681
+ * addTagMiddleware('admin', [adminMiddleware])
653
682
  */
654
- export const addMiddleware = (tag: string, middleware: PikkuMiddleware[]) => {
655
- addMiddlewareCore(tag, middleware as any, '@pikku/addon-ollama')
683
+ export const addTagMiddleware = (tag: string, middleware: PikkuMiddleware[]) => {
684
+ addTagMiddlewareCore(tag, middleware as any, '@pikku/addon-ollama')
656
685
  }
657
686
 
658
687
  /**
659
- * Adds global permissions for a specific tag.
688
+ * Wire-agnostic global middleware. Runs at the top of every wiring's
689
+ * middleware chain — before wire-, tag-, and function-level entries.
660
690
  *
661
- * This function allows you to register permissions that will be applied to
662
- * any wiring (HTTP, Channel, Queue, Scheduler, MCP) that includes the matching tag.
691
+ * Resolution order: global -> wire -> tag -> function.
663
692
  *
664
- * @param tag - The tag that the permissions should apply to.
665
- * @param permissions - The permissions array or object to apply for the specified tag.
666
- *
667
- * @throws Error if permissions for the tag already exist.
693
+ * @example
694
+ * addGlobalMiddleware([telemetryMiddleware])
695
+ */
696
+ export const addGlobalMiddleware = (middleware: PikkuMiddleware[]) => {
697
+ addGlobalMiddlewareCore(middleware as any, '@pikku/addon-ollama')
698
+ }
699
+
700
+ /**
701
+ * Tag-scoped permissions. Applies to any wiring that carries the matching tag.
668
702
  *
669
703
  * @example
670
- * ```typescript
671
- * // Add admin permissions for admin endpoints
672
- * addPermission('admin', [adminPermission])
704
+ * addTagPermission('admin', [adminPermission])
705
+ */
706
+ export const addTagPermission = <In = unknown>(tag: string, permissions: CorePermissionGroup<PikkuPermission<In>> | PikkuPermission<In>[]) => {
707
+ addTagPermissionCore(tag, permissions as any, '@pikku/addon-ollama')
708
+ }
709
+
710
+ /**
711
+ * Wire-agnostic global permissions. Runs at the top of every wiring's
712
+ * permission resolution — before wire-, tag-, and function-level entries.
673
713
  *
674
- * // Add authentication permissions for auth endpoints
675
- * addPermission('auth', [authPermission])
714
+ * Resolution order: global -> wire -> tag -> function.
676
715
  *
677
- * // Add read permissions for all API endpoints (as object)
678
- * addPermission('api', { read: readPermission })
679
- * ```
716
+ * @example
717
+ * addGlobalPermission([signedInUser])
680
718
  */
681
- export const addPermission = <In = unknown>(tag: string, permissions: CorePermissionGroup<PikkuPermission<In>> | PikkuPermission<In>[]) => {
682
- addPermissionCore(tag, permissions as any, '@pikku/addon-ollama')
719
+ export const addGlobalPermission = <In = unknown>(permissions: CorePermissionGroup<PikkuPermission<In>> | PikkuPermission<In>[]) => {
720
+ addGlobalPermissionCore(permissions as any, '@pikku/addon-ollama')
683
721
  }
684
722
 
685
- export { wireAddon } from '@pikku/core'
686
- export type { WireAddonConfig } from '@pikku/core'
723
+ export { wireAddon } from '@pikku/core/rpc'
724
+ export type { WireAddonConfig } from '@pikku/core/rpc'
725
+
726
+
727
+ /**
728
+ * Addon contract references. Generated from each wired addon's published
729
+ * contract metadata — no addon source is imported. Functions are proxied via
730
+ * ref() (RPC) exactly like ref('namespace:fn').
731
+ */
732
+ const __addonHttp = {} as const
733
+ const __addonChannel = {} as const
734
+ const __addonCli = {} as const
735
+
736
+ export const refHTTP = <Name extends keyof typeof __addonHttp>(
737
+ name: Name,
738
+ options?: { basePath?: string }
739
+ ): (typeof __addonHttp)[Name] => {
740
+ const contract = __addonHttp[name] as any
741
+ return (
742
+ options?.basePath !== undefined
743
+ ? { ...contract, basePath: options.basePath }
744
+ : contract
745
+ ) as (typeof __addonHttp)[Name]
746
+ }
747
+
748
+ export const refChannel = <Name extends keyof typeof __addonChannel>(
749
+ name: Name
750
+ ): (typeof __addonChannel)[Name] => __addonChannel[name]
751
+
752
+ export const refCLI = <Name extends keyof typeof __addonCli>(
753
+ name: Name
754
+ ): (typeof __addonCli)[Name] => __addonCli[name]
@@ -1,106 +1,118 @@
1
1
  {
2
- "ollamaGenerateText": {
3
- "pikkuFuncId": "ollamaGenerateText",
2
+ "ollamaEmbedMany": {
3
+ "pikkuFuncId": "ollamaEmbedMany",
4
4
  "functionType": "user",
5
5
  "funcWrapper": "pikkuSessionlessFunc",
6
6
  "sessionless": true,
7
- "name": "ollamaGenerateText",
7
+ "name": "ollamaEmbedMany",
8
8
  "services": {
9
9
  "optimized": true,
10
10
  "services": [
11
11
  "ollama"
12
12
  ]
13
13
  },
14
- "inputSchemaName": "OllamaGenerateTextInput",
15
- "outputSchemaName": "OllamaGenerateTextOutput",
14
+ "inputSchemaName": "OllamaEmbedManyInput",
15
+ "outputSchemaName": "OllamaEmbedManyOutput",
16
16
  "inputs": [
17
- "OllamaGenerateTextInput"
17
+ "OllamaEmbedManyInput"
18
18
  ],
19
19
  "outputs": [
20
- "OllamaGenerateTextOutput"
20
+ "OllamaEmbedManyOutput"
21
21
  ],
22
- "description": "Generate text using an Ollama model",
22
+ "implementationHash": "2abe1562dff3ca44",
23
+ "description": "Create embedding vectors from multiple texts using an Ollama model",
23
24
  "isDirectFunction": false,
24
- "contractHash": "0d03988593f9adef",
25
- "inputHash": "bdf047a6",
26
- "outputHash": "4e2c22b3"
25
+ "sourceFile": "/home/runner/work/addons/addons/packages/ai/ollama/src/functions/embeddings/embed-many.function.ts",
26
+ "exportedName": "ollamaEmbedMany",
27
+ "contractHash": "3db02092482ca9c6",
28
+ "inputHash": "4f6f4b67",
29
+ "outputHash": "54a0cfe3"
27
30
  },
28
- "ollamaGenerateObject": {
29
- "pikkuFuncId": "ollamaGenerateObject",
31
+ "ollamaEmbed": {
32
+ "pikkuFuncId": "ollamaEmbed",
30
33
  "functionType": "user",
31
34
  "funcWrapper": "pikkuSessionlessFunc",
32
35
  "sessionless": true,
33
- "name": "ollamaGenerateObject",
36
+ "name": "ollamaEmbed",
34
37
  "services": {
35
38
  "optimized": true,
36
39
  "services": [
37
40
  "ollama"
38
41
  ]
39
42
  },
40
- "inputSchemaName": "OllamaGenerateObjectInput",
41
- "outputSchemaName": "OllamaGenerateObjectOutput",
43
+ "inputSchemaName": "OllamaEmbedInput",
44
+ "outputSchemaName": "OllamaEmbedOutput",
42
45
  "inputs": [
43
- "OllamaGenerateObjectInput"
46
+ "OllamaEmbedInput"
44
47
  ],
45
48
  "outputs": [
46
- "OllamaGenerateObjectOutput"
49
+ "OllamaEmbedOutput"
47
50
  ],
48
- "description": "Generate a structured JSON object using an Ollama model",
51
+ "implementationHash": "ac6fc8ad50940ac6",
52
+ "description": "Create an embedding vector from text using an Ollama model",
49
53
  "isDirectFunction": false,
50
- "contractHash": "e7026856e15a96b5",
51
- "inputHash": "4ceb54b7",
52
- "outputHash": "e26f98ba"
54
+ "sourceFile": "/home/runner/work/addons/addons/packages/ai/ollama/src/functions/embeddings/embed.function.ts",
55
+ "exportedName": "ollamaEmbed",
56
+ "contractHash": "0354ea934b747af7",
57
+ "inputHash": "8340c2c0",
58
+ "outputHash": "bb88b854"
53
59
  },
54
- "ollamaEmbed": {
55
- "pikkuFuncId": "ollamaEmbed",
60
+ "ollamaGenerateObject": {
61
+ "pikkuFuncId": "ollamaGenerateObject",
56
62
  "functionType": "user",
57
63
  "funcWrapper": "pikkuSessionlessFunc",
58
64
  "sessionless": true,
59
- "name": "ollamaEmbed",
65
+ "name": "ollamaGenerateObject",
60
66
  "services": {
61
67
  "optimized": true,
62
68
  "services": [
63
69
  "ollama"
64
70
  ]
65
71
  },
66
- "inputSchemaName": "OllamaEmbedInput",
67
- "outputSchemaName": "OllamaEmbedOutput",
72
+ "inputSchemaName": "OllamaGenerateObjectInput",
73
+ "outputSchemaName": "OllamaGenerateObjectOutput",
68
74
  "inputs": [
69
- "OllamaEmbedInput"
75
+ "OllamaGenerateObjectInput"
70
76
  ],
71
77
  "outputs": [
72
- "OllamaEmbedOutput"
78
+ "OllamaGenerateObjectOutput"
73
79
  ],
74
- "description": "Create an embedding vector from text using an Ollama model",
80
+ "implementationHash": "267ece83350ede19",
81
+ "description": "Generate a structured JSON object using an Ollama model",
75
82
  "isDirectFunction": false,
76
- "contractHash": "0354ea934b747af7",
77
- "inputHash": "8340c2c0",
78
- "outputHash": "bb88b854"
83
+ "sourceFile": "/home/runner/work/addons/addons/packages/ai/ollama/src/functions/text/generate-object.function.ts",
84
+ "exportedName": "ollamaGenerateObject",
85
+ "contractHash": "e7026856e15a96b5",
86
+ "inputHash": "4ceb54b7",
87
+ "outputHash": "e26f98ba"
79
88
  },
80
- "ollamaEmbedMany": {
81
- "pikkuFuncId": "ollamaEmbedMany",
89
+ "ollamaGenerateText": {
90
+ "pikkuFuncId": "ollamaGenerateText",
82
91
  "functionType": "user",
83
92
  "funcWrapper": "pikkuSessionlessFunc",
84
93
  "sessionless": true,
85
- "name": "ollamaEmbedMany",
94
+ "name": "ollamaGenerateText",
86
95
  "services": {
87
96
  "optimized": true,
88
97
  "services": [
89
98
  "ollama"
90
99
  ]
91
100
  },
92
- "inputSchemaName": "OllamaEmbedManyInput",
93
- "outputSchemaName": "OllamaEmbedManyOutput",
101
+ "inputSchemaName": "OllamaGenerateTextInput",
102
+ "outputSchemaName": "OllamaGenerateTextOutput",
94
103
  "inputs": [
95
- "OllamaEmbedManyInput"
104
+ "OllamaGenerateTextInput"
96
105
  ],
97
106
  "outputs": [
98
- "OllamaEmbedManyOutput"
107
+ "OllamaGenerateTextOutput"
99
108
  ],
100
- "description": "Create embedding vectors from multiple texts using an Ollama model",
109
+ "implementationHash": "24061cbafdbafa6a",
110
+ "description": "Generate text using an Ollama model",
101
111
  "isDirectFunction": false,
102
- "contractHash": "3db02092482ca9c6",
103
- "inputHash": "4f6f4b67",
104
- "outputHash": "54a0cfe3"
112
+ "sourceFile": "/home/runner/work/addons/addons/packages/ai/ollama/src/functions/text/generate.function.ts",
113
+ "exportedName": "ollamaGenerateText",
114
+ "contractHash": "0d03988593f9adef",
115
+ "inputHash": "bdf047a6",
116
+ "outputHash": "4e2c22b3"
105
117
  }
106
118
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.6
2
+ * This file was generated by @pikku/cli@0.12.55
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal';
5
5
  import metaData from './pikku-functions-meta.gen.json' with { type: 'json' };
@@ -1,39 +1,22 @@
1
1
  {
2
- "ollamaGenerateText": {
3
- "pikkuFuncId": "ollamaGenerateText",
4
- "functionType": "user",
5
- "funcWrapper": "pikkuSessionlessFunc",
6
- "sessionless": true,
7
- "name": "ollamaGenerateText",
8
- "inputSchemaName": "OllamaGenerateTextInput",
9
- "outputSchemaName": "OllamaGenerateTextOutput",
10
- "inputs": [
11
- "OllamaGenerateTextInput"
12
- ],
13
- "outputs": [
14
- "OllamaGenerateTextOutput"
15
- ],
16
- "contractHash": "0d03988593f9adef",
17
- "inputHash": "bdf047a6",
18
- "outputHash": "4e2c22b3"
19
- },
20
- "ollamaGenerateObject": {
21
- "pikkuFuncId": "ollamaGenerateObject",
2
+ "ollamaEmbedMany": {
3
+ "pikkuFuncId": "ollamaEmbedMany",
22
4
  "functionType": "user",
23
5
  "funcWrapper": "pikkuSessionlessFunc",
24
6
  "sessionless": true,
25
- "name": "ollamaGenerateObject",
26
- "inputSchemaName": "OllamaGenerateObjectInput",
27
- "outputSchemaName": "OllamaGenerateObjectOutput",
7
+ "name": "ollamaEmbedMany",
8
+ "inputSchemaName": "OllamaEmbedManyInput",
9
+ "outputSchemaName": "OllamaEmbedManyOutput",
28
10
  "inputs": [
29
- "OllamaGenerateObjectInput"
11
+ "OllamaEmbedManyInput"
30
12
  ],
31
13
  "outputs": [
32
- "OllamaGenerateObjectOutput"
14
+ "OllamaEmbedManyOutput"
33
15
  ],
34
- "contractHash": "e7026856e15a96b5",
35
- "inputHash": "4ceb54b7",
36
- "outputHash": "e26f98ba"
16
+ "implementationHash": "2abe1562dff3ca44",
17
+ "contractHash": "3db02092482ca9c6",
18
+ "inputHash": "4f6f4b67",
19
+ "outputHash": "54a0cfe3"
37
20
  },
38
21
  "ollamaEmbed": {
39
22
  "pikkuFuncId": "ollamaEmbed",
@@ -49,26 +32,47 @@
49
32
  "outputs": [
50
33
  "OllamaEmbedOutput"
51
34
  ],
35
+ "implementationHash": "ac6fc8ad50940ac6",
52
36
  "contractHash": "0354ea934b747af7",
53
37
  "inputHash": "8340c2c0",
54
38
  "outputHash": "bb88b854"
55
39
  },
56
- "ollamaEmbedMany": {
57
- "pikkuFuncId": "ollamaEmbedMany",
40
+ "ollamaGenerateObject": {
41
+ "pikkuFuncId": "ollamaGenerateObject",
58
42
  "functionType": "user",
59
43
  "funcWrapper": "pikkuSessionlessFunc",
60
44
  "sessionless": true,
61
- "name": "ollamaEmbedMany",
62
- "inputSchemaName": "OllamaEmbedManyInput",
63
- "outputSchemaName": "OllamaEmbedManyOutput",
45
+ "name": "ollamaGenerateObject",
46
+ "inputSchemaName": "OllamaGenerateObjectInput",
47
+ "outputSchemaName": "OllamaGenerateObjectOutput",
64
48
  "inputs": [
65
- "OllamaEmbedManyInput"
49
+ "OllamaGenerateObjectInput"
66
50
  ],
67
51
  "outputs": [
68
- "OllamaEmbedManyOutput"
52
+ "OllamaGenerateObjectOutput"
69
53
  ],
70
- "contractHash": "3db02092482ca9c6",
71
- "inputHash": "4f6f4b67",
72
- "outputHash": "54a0cfe3"
54
+ "implementationHash": "267ece83350ede19",
55
+ "contractHash": "e7026856e15a96b5",
56
+ "inputHash": "4ceb54b7",
57
+ "outputHash": "e26f98ba"
58
+ },
59
+ "ollamaGenerateText": {
60
+ "pikkuFuncId": "ollamaGenerateText",
61
+ "functionType": "user",
62
+ "funcWrapper": "pikkuSessionlessFunc",
63
+ "sessionless": true,
64
+ "name": "ollamaGenerateText",
65
+ "inputSchemaName": "OllamaGenerateTextInput",
66
+ "outputSchemaName": "OllamaGenerateTextOutput",
67
+ "inputs": [
68
+ "OllamaGenerateTextInput"
69
+ ],
70
+ "outputs": [
71
+ "OllamaGenerateTextOutput"
72
+ ],
73
+ "implementationHash": "24061cbafdbafa6a",
74
+ "contractHash": "0d03988593f9adef",
75
+ "inputHash": "bdf047a6",
76
+ "outputHash": "4e2c22b3"
73
77
  }
74
78
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.6
2
+ * This file was generated by @pikku/cli@0.12.55
3
3
  */
4
4
  import { pikkuState } from '@pikku/core/internal'
5
5
  import type { FunctionsMeta } from '@pikku/core'
@@ -1,8 +1,8 @@
1
1
  /**
2
- * This file was generated by @pikku/cli@0.12.6
2
+ * This file was generated by @pikku/cli@0.12.55
3
3
  */
4
4
  /* Import and register functions used by RPCs */
5
- import { addFunction } from '@pikku/core';
5
+ import { addFunction } from '@pikku/core/function';
6
6
  import { ollamaEmbed } from '../../src/functions/embeddings/embed.function.js';
7
7
  import { ollamaEmbedMany } from '../../src/functions/embeddings/embed-many.function.js';
8
8
  import { ollamaGenerateObject } from '../../src/functions/text/generate-object.function.js';