@pikku/addon-ollama 0.1.1 → 0.1.3
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.
- package/.pikku/addon/pikku-addon-types.gen.ts +105 -0
- package/.pikku/addon/pikku-package.gen.ts +11 -0
- package/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
- package/.pikku/agent/pikku-agent-types.gen.ts +84 -0
- package/.pikku/channel/pikku-channel-types.gen.ts +177 -0
- package/.pikku/console/pikku-addon-meta.gen.json +61 -0
- package/.pikku/console/pikku-node-types.gen.ts +8 -0
- package/.pikku/function/pikku-function-types.gen.ts +797 -0
- package/.pikku/function/pikku-functions-meta-verbose.gen.json +126 -0
- package/.pikku/function/pikku-functions-meta.gen.json +102 -0
- package/.pikku/function/pikku-functions-meta.gen.ts +7 -0
- package/.pikku/function/pikku-functions.gen.ts +14 -0
- package/.pikku/http/pikku-http-types.gen.ts +119 -0
- package/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
- package/.pikku/pikku-bootstrap-scenarios.gen.ts +9 -0
- package/.pikku/pikku-bootstrap.gen.ts +8 -0
- package/.pikku/pikku-meta-service.gen.ts +10 -0
- package/.pikku/pikku-services.gen.ts +50 -0
- package/.pikku/pikku-types.gen.ts +24 -0
- package/.pikku/queue/pikku-queue-types.gen.ts +27 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +207 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +211 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.remote.gen.d.ts +207 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +6 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
- package/.pikku/scenarios/features.gen.json +1 -0
- package/.pikku/scenarios/pikku-scenario-functions-meta.gen.json +1 -0
- package/.pikku/scenarios/pikku-scenario-functions-meta.gen.ts +12 -0
- package/.pikku/scenarios/pikku-scenario-functions.gen.ts +4 -0
- package/.pikku/scenarios/pikku-scenario-wirings-meta.gen.ts +15 -0
- package/.pikku/scenarios/pikku-scenario-wirings.gen.ts +4 -0
- package/.pikku/scenarios/schemas/register.gen.ts +4 -0
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
- package/.pikku/schemas/register.gen.ts +39 -0
- package/.pikku/schemas/schemas/OllamaEmbedInput.schema.json +1 -0
- package/.pikku/schemas/schemas/OllamaEmbedManyInput.schema.json +1 -0
- package/.pikku/schemas/schemas/OllamaEmbedManyOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/OllamaEmbedOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/OllamaGenerateObjectInput.schema.json +1 -0
- package/.pikku/schemas/schemas/OllamaGenerateObjectOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/OllamaGenerateTextInput.schema.json +1 -0
- package/.pikku/schemas/schemas/OllamaGenerateTextOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/VariableSchema_ollama_base_url.schema.json +1 -0
- package/.pikku/scopes/pikku-personas-meta.gen.json +1 -0
- package/.pikku/scopes/pikku-personas.gen.ts +52 -0
- package/.pikku/scopes/pikku-roles-meta.gen.json +1 -0
- package/.pikku/scopes/pikku-roles.gen.ts +41 -0
- package/.pikku/scopes/pikku-scope-types.gen.ts +7 -0
- package/.pikku/scopes/pikku-scopes-meta.gen.json +1 -0
- package/.pikku/scopes/pikku-scopes.gen.ts +58 -0
- package/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
- package/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
- package/.pikku/secrets/pikku-secrets.gen.ts +34 -0
- package/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
- package/.pikku/variables/pikku-variable-types.gen.ts +5 -0
- package/.pikku/variables/pikku-variables-meta.gen.json +10 -0
- package/.pikku/variables/pikku-variables.gen.ts +36 -0
- package/.pikku/workflow/personas.gen.json +1 -0
- package/.pikku/workflow/pikku-personas.gen.ts +38 -0
- package/.pikku/workflow/pikku-scenario-step-map.gen.d.ts +18 -0
- package/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
- package/.pikku/workflow/pikku-workflow-types.gen.ts +591 -0
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
- package/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +4 -4
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.js +7 -3
- package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.ts +11 -6
- package/dist/.pikku/addon/pikku-package.gen.js +2 -1
- package/dist/.pikku/addon/pikku-package.gen.js.map +1 -1
- package/dist/.pikku/addon/pikku-package.gen.ts +3 -1
- package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +2 -14
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +8 -6
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.ts +15 -7
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +112 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts.map +1 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.js +60 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.js.map +1 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.ts +177 -0
- package/dist/.pikku/console/pikku-addon-meta.gen.json +31 -28
- package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
- package/dist/.pikku/console/pikku-node-types.gen.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +133 -133
- package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.js +98 -61
- package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.ts +268 -157
- package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +64 -44
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +67 -39
- package/dist/.pikku/function/pikku-functions-meta.gen.ts +1 -1
- package/dist/.pikku/function/pikku-functions.gen.js +2 -2
- package/dist/.pikku/function/pikku-functions.gen.js.map +1 -1
- package/dist/.pikku/function/pikku-functions.gen.ts +2 -2
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +98 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -0
- package/dist/.pikku/http/pikku-http-types.gen.js +50 -0
- package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -0
- package/dist/.pikku/http/pikku-http-types.gen.ts +119 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +131 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts.map +1 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +38 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js.map +1 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts +10 -0
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.js +10 -0
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.js.map +1 -0
- package/dist/.pikku/pikku-bootstrap-scenarios.gen.ts +9 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +4 -2
- package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +2 -10
- package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.ts +2 -9
- package/dist/.pikku/pikku-meta-service.gen.d.ts +8 -0
- package/dist/.pikku/pikku-meta-service.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-meta-service.gen.js +10 -0
- package/dist/.pikku/pikku-meta-service.gen.js.map +1 -0
- package/dist/.pikku/pikku-meta-service.gen.ts +10 -0
- package/dist/.pikku/pikku-services.gen.d.ts +15 -2
- package/dist/.pikku/pikku-services.gen.d.ts.map +1 -1
- package/dist/.pikku/pikku-services.gen.js +14 -0
- package/dist/.pikku/pikku-services.gen.js.map +1 -1
- package/dist/.pikku/pikku-services.gen.ts +17 -2
- package/dist/.pikku/pikku-types.gen.d.ts +2 -1
- package/dist/.pikku/pikku-types.gen.d.ts.map +1 -1
- package/dist/.pikku/pikku-types.gen.js +3 -1
- package/dist/.pikku/pikku-types.gen.js.map +1 -1
- package/dist/.pikku/pikku-types.gen.ts +4 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +24 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts.map +1 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.js +17 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.js.map +1 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.ts +27 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +81 -62
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +84 -65
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.remote.gen.d.ts +207 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +2 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts.map +1 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +7 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js.map +1 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +6 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
- package/dist/.pikku/scenarios/features.gen.json +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.d.ts +2 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.d.ts.map +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js +11 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.js.map +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.json +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions-meta.gen.ts +12 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts +5 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.d.ts.map +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.js +2 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.js.map +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-functions.gen.ts +4 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.d.ts +2 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.d.ts.map +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js +11 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.js.map +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings-meta.gen.ts +15 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts +5 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.d.ts.map +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.js +2 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.js.map +1 -0
- package/dist/.pikku/scenarios/pikku-scenario-wirings.gen.ts +4 -0
- package/dist/.pikku/scenarios/schemas/register.gen.d.ts +5 -0
- package/dist/.pikku/scenarios/schemas/register.gen.d.ts.map +1 -0
- package/dist/.pikku/scenarios/schemas/register.gen.js +5 -0
- package/dist/.pikku/scenarios/schemas/register.gen.js.map +1 -0
- package/dist/.pikku/scenarios/schemas/register.gen.ts +4 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +22 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts.map +1 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +17 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js.map +1 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
- package/dist/.pikku/schemas/register.gen.js +11 -11
- package/dist/.pikku/schemas/register.gen.js.map +1 -1
- package/dist/.pikku/schemas/register.gen.ts +17 -17
- package/dist/.pikku/scopes/pikku-personas-meta.gen.json +1 -0
- package/dist/.pikku/scopes/pikku-personas.gen.d.ts +37 -0
- package/dist/.pikku/scopes/pikku-personas.gen.d.ts.map +1 -0
- package/dist/.pikku/scopes/pikku-personas.gen.js +18 -0
- package/dist/.pikku/scopes/pikku-personas.gen.js.map +1 -0
- package/dist/.pikku/scopes/pikku-personas.gen.ts +52 -0
- package/dist/.pikku/scopes/pikku-roles-meta.gen.json +1 -0
- package/dist/.pikku/scopes/pikku-roles.gen.d.ts +31 -0
- package/dist/.pikku/scopes/pikku-roles.gen.d.ts.map +1 -0
- package/dist/.pikku/scopes/pikku-roles.gen.js +19 -0
- package/dist/.pikku/scopes/pikku-roles.gen.js.map +1 -0
- package/dist/.pikku/scopes/pikku-roles.gen.ts +41 -0
- package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts +8 -0
- package/dist/.pikku/scopes/pikku-scope-types.gen.d.ts.map +1 -0
- package/dist/.pikku/scopes/pikku-scope-types.gen.js +6 -0
- package/dist/.pikku/scopes/pikku-scope-types.gen.js.map +1 -0
- package/dist/.pikku/scopes/pikku-scope-types.gen.ts +7 -0
- package/dist/.pikku/scopes/pikku-scopes-meta.gen.json +1 -0
- package/dist/.pikku/scopes/pikku-scopes.gen.d.ts +36 -0
- package/dist/.pikku/scopes/pikku-scopes.gen.d.ts.map +1 -0
- package/dist/.pikku/scopes/pikku-scopes.gen.js +28 -0
- package/dist/.pikku/scopes/pikku-scopes.gen.js.map +1 -0
- package/dist/.pikku/scopes/pikku-scopes.gen.ts +58 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +2 -2
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts.map +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +2 -2
- package/dist/.pikku/secrets/pikku-secret-types.gen.js.map +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.ts +2 -2
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +11 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts.map +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +11 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js.map +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.ts +14 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +2 -2
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts.map +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.js +2 -2
- package/dist/.pikku/variables/pikku-variable-types.gen.js.map +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.ts +2 -2
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +11 -1
- package/dist/.pikku/variables/pikku-variables.gen.d.ts.map +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +14 -4
- package/dist/.pikku/variables/pikku-variables.gen.js.map +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.ts +17 -4
- package/dist/.pikku/workflow/personas.gen.json +1 -0
- package/dist/.pikku/workflow/pikku-personas.gen.d.ts +16 -0
- package/dist/.pikku/workflow/pikku-personas.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-personas.gen.js +18 -0
- package/dist/.pikku/workflow/pikku-personas.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-personas.gen.ts +38 -0
- package/dist/.pikku/workflow/pikku-scenario-step-map.gen.d.ts +18 -0
- package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +9 -5
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +289 -31
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +66 -18
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +494 -61
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +3 -3
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +1 -1
- package/dist/src/functions/embeddings/embed-many.function.d.ts +2 -2
- package/dist/src/functions/embeddings/embed-many.function.d.ts.map +1 -1
- package/dist/src/functions/embeddings/embed.function.d.ts +2 -2
- package/dist/src/functions/embeddings/embed.function.d.ts.map +1 -1
- package/dist/src/functions/text/generate-object.function.d.ts +7 -7
- package/dist/src/functions/text/generate-object.function.d.ts.map +1 -1
- package/dist/src/functions/text/generate.function.d.ts +2 -2
- package/dist/src/functions/text/generate.function.d.ts.map +1 -1
- package/dist/src/ollama.variable.js +2 -2
- package/dist/src/ollama.variable.js.map +1 -1
- package/package.json +7 -6
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts +0 -2
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +0 -7
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.json +0 -3
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.ts +0 -7
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +0 -5
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js +0 -5
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.ts +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Addon package types for pikkuAddonConfig and pikkuAddonServices
|
|
@@ -31,7 +31,7 @@ export const pikkuAddonConfig = (func) => {
|
|
|
31
31
|
* config,
|
|
32
32
|
* { secrets }
|
|
33
33
|
* ) => {
|
|
34
|
-
* const creds = await secrets.
|
|
34
|
+
* const creds = await secrets.getSecret<GithubCredentials>('GITHUB_CREDENTIALS')
|
|
35
35
|
* const github = new GithubService(creds)
|
|
36
36
|
* return { github }
|
|
37
37
|
* })
|
|
@@ -69,6 +69,10 @@ export const pikkuAddonServices = (func) => {
|
|
|
69
69
|
* ```
|
|
70
70
|
*/
|
|
71
71
|
export const pikkuAddonWireServices = (func) => {
|
|
72
|
-
return
|
|
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
|
+
});
|
|
73
77
|
};
|
|
74
78
|
//# sourceMappingURL=pikku-addon-types.gen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pikku-addon-types.gen.js","sourceRoot":"","sources":["../../../.pikku/addon/pikku-addon-types.gen.ts"],"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,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,EAAE,GAAG,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAsB,CAAC,CAAA;QACxI,OAAO;YACL,MAAM;YACN,MAAM;YACN,MAAM;YACN,SAAS,EAAE,cAAc;YACzB,OAAO,EAAE,YAAY;YACrB,GAAG,MAAM;SAC8B,CAAA;IAC3C,CAAC,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,IAAmF,EACnF,EAAE;IACF,OAAO,CAAC,CAAC,QAAa,EAAE,IAAe,EAAE,EAAE;QACzC,MAAM,cAAc,GAAG,IAAI,qBAAqB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;QACpE,MAAM,YAAY,GAAG,IAAI,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC7D,OAAO,IAAI,CAAC,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAsB,EAAE,IAAI,CAAC,CAAA;IAC1G,CAAC,CAAQ,CAAA;AACX,CAAC,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
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.
|
|
57
|
+
* const creds = await secrets.getSecret<GithubCredentials>('GITHUB_CREDENTIALS')
|
|
57
58
|
* const github = new GithubService(creds)
|
|
58
59
|
* return { github }
|
|
59
60
|
* })
|
|
@@ -93,8 +94,12 @@ export const pikkuAddonServices = <T extends Record<string, any>, ExistingServic
|
|
|
93
94
|
* })
|
|
94
95
|
* ```
|
|
95
96
|
*/
|
|
96
|
-
export const pikkuAddonWireServices = (
|
|
97
|
-
func: (services:
|
|
97
|
+
export const pikkuAddonWireServices = <ExistingServices extends Omit<Partial<SingletonServices>, 'variables' | 'secrets'> & AddonBaseServices>(
|
|
98
|
+
func: (services: ExistingServices, wire: PikkuWire) => Promise<Record<string, any>>
|
|
98
99
|
) => {
|
|
99
|
-
return
|
|
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
|
|
100
105
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
3
3
|
*/
|
|
4
4
|
import { pikkuState } from '@pikku/core/internal';
|
|
5
5
|
import { createSingletonServices as createSingletonServices } from '../../src/services.js';
|
|
6
6
|
pikkuState('@pikku/addon-ollama', 'package', 'factories', {
|
|
7
7
|
createSingletonServices,
|
|
8
8
|
});
|
|
9
|
+
pikkuState('@pikku/addon-ollama', 'package', 'requiredParentServices', ["variables"]);
|
|
9
10
|
//# sourceMappingURL=pikku-package.gen.js.map
|
|
@@ -1 +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,qBAAqB,EAAE,SAAS,EAAE,WAAW,EAAE;IACxD,uBAAuB;CACxB,CAAC,CAAA"}
|
|
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,qBAAqB,EAAE,SAAS,EAAE,WAAW,EAAE;IACxD,uBAAuB;CACxB,CAAC,CAAA;AAEF,UAAU,CAAC,qBAAqB,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
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.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
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,21 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
3
3
|
*/
|
|
4
4
|
import { CoreAIAgent, PikkuAIMiddlewareHooks } from '@pikku/core/ai-agent';
|
|
5
5
|
import type { PikkuPermission, PikkuMiddleware, Services, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js';
|
|
6
6
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
7
|
import type { AIAgentMemoryConfig, AIAgentInput } from '@pikku/core/ai-agent';
|
|
8
8
|
import type { AgentMap } from './pikku-agent-map.gen.d.js';
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import type { ScopeId } from '../scopes/pikku-scopes.gen.js';
|
|
10
|
+
type AIAgentConfig<InputSchema extends StandardSchemaV1 | undefined = undefined, OutputSchema extends StandardSchemaV1 | undefined = undefined> = Omit<CoreAIAgent<PikkuPermission, PikkuMiddleware, ScopeId>, 'tools' | 'agents' | 'workflows' | 'memory' | 'input' | 'output'> & {
|
|
11
|
+
input?: InputSchema;
|
|
12
|
+
output?: OutputSchema;
|
|
12
13
|
memory?: Omit<AIAgentMemoryConfig, 'workingMemory'> & {
|
|
13
14
|
workingMemory?: StandardSchemaV1;
|
|
14
15
|
};
|
|
15
16
|
tools?: object[];
|
|
16
|
-
agents?: AIAgentConfig[];
|
|
17
|
+
agents?: AIAgentConfig<StandardSchemaV1 | undefined, StandardSchemaV1 | undefined>[];
|
|
18
|
+
workflows?: object[];
|
|
17
19
|
};
|
|
18
|
-
export declare const pikkuAIAgent: (agent: AIAgentConfig) => AIAgentConfig
|
|
20
|
+
export declare const pikkuAIAgent: <InputSchema extends StandardSchemaV1 | undefined = undefined, OutputSchema extends StandardSchemaV1 | undefined = undefined>(agent: AIAgentConfig<InputSchema, OutputSchema>) => AIAgentConfig<InputSchema, OutputSchema>;
|
|
19
21
|
export declare const pikkuAIMiddleware: <State extends Record<string, unknown> = Record<string, unknown>, RequiredServices extends Services = Services>(hooks: PikkuAIMiddlewareHooks<State, RequiredServices>) => PikkuAIMiddlewareHooks<State, RequiredServices>;
|
|
20
22
|
export declare const agent: <Name extends keyof AgentMap>(agentName: Name) => PikkuFunctionConfig<AIAgentInput, {
|
|
21
23
|
runId: string;
|
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"pikku-agent-types.gen.d.ts","sourceRoot":"","sources":["../../../.pik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I,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"}
|
|
@@ -1 +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;
|
|
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;AAmB7B,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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
CoreAIAgent,
|
|
@@ -15,17 +15,25 @@ import type { PikkuPermission, PikkuMiddleware, Services, PikkuFunctionConfig }
|
|
|
15
15
|
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
|
+
import type { ScopeId } from '../scopes/pikku-scopes.gen.js'
|
|
18
19
|
|
|
19
|
-
type AIAgentConfig
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
type AIAgentConfig<
|
|
21
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
22
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
23
|
+
> = Omit<CoreAIAgent<PikkuPermission, PikkuMiddleware, ScopeId>, 'tools' | 'agents' | 'workflows' | 'memory' | 'input' | 'output'> & {
|
|
24
|
+
input?: InputSchema
|
|
25
|
+
output?: OutputSchema
|
|
22
26
|
memory?: Omit<AIAgentMemoryConfig, 'workingMemory'> & { workingMemory?: StandardSchemaV1 }
|
|
23
27
|
tools?: object[]
|
|
24
|
-
agents?: AIAgentConfig[]
|
|
28
|
+
agents?: AIAgentConfig<StandardSchemaV1 | undefined, StandardSchemaV1 | undefined>[]
|
|
29
|
+
workflows?: object[]
|
|
25
30
|
}
|
|
26
31
|
|
|
27
|
-
export const pikkuAIAgent =
|
|
28
|
-
|
|
32
|
+
export const pikkuAIAgent = <
|
|
33
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
34
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
35
|
+
>(
|
|
36
|
+
agent: AIAgentConfig<InputSchema, OutputSchema>
|
|
29
37
|
) => {
|
|
30
38
|
return agent
|
|
31
39
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Channel-specific type definitions for tree-shaking optimization
|
|
6
|
+
*/
|
|
7
|
+
import { CoreChannel, CorePikkuChannelMiddleware, CorePikkuChannelMiddlewareFactory } from '@pikku/core/channel';
|
|
8
|
+
import { AssertHTTPWiringParams } from '@pikku/core/http';
|
|
9
|
+
import type { PikkuFunctionConfig, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware, Services } from '../function/pikku-function-types.gen.js';
|
|
10
|
+
import type { CorePermissionGroup } from '@pikku/core';
|
|
11
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
12
|
+
/**
|
|
13
|
+
* Helper type to infer the output type from a Standard Schema
|
|
14
|
+
*/
|
|
15
|
+
type InferSchemaOutput<T> = T extends StandardSchemaV1<any, infer Output> ? Output : never;
|
|
16
|
+
/**
|
|
17
|
+
* Type definition for WebSocket channels with typed data exchange.
|
|
18
|
+
* Supports connection, disconnection, and message handling.
|
|
19
|
+
* Accepts both session-based (PikkuFunction) and sessionless (PikkuFunctionSessionless) functions.
|
|
20
|
+
*
|
|
21
|
+
* @template ChannelData - Type of data exchanged through the channel
|
|
22
|
+
* @template Channel - String literal type for the channel name
|
|
23
|
+
*/
|
|
24
|
+
type ChannelWiring<ChannelData, Channel extends string> = CoreChannel<ChannelData, Channel, PikkuFunctionConfig<void, any, 'channel' | 'session' | 'rpc'>, PikkuFunctionConfig<void, void, 'channel' | 'session' | 'rpc'>, PikkuFunctionConfig<any, any, 'channel' | 'session' | 'rpc'>, PikkuPermission, PikkuMiddleware>;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a function that handles WebSocket channel connections.
|
|
27
|
+
* Called when a client connects to a channel.
|
|
28
|
+
*
|
|
29
|
+
* @template Out - Output type for connection response
|
|
30
|
+
* @param func - Function definition, either direct function or configuration object
|
|
31
|
+
* @returns The normalized configuration object
|
|
32
|
+
*/
|
|
33
|
+
export declare const pikkuChannelConnectionFunc: <Out = unknown>(func: PikkuFunctionSessionless<void, Out, "channel" | "session" | "rpc"> | PikkuFunctionConfig<void, Out, "channel" | "session" | "rpc">) => PikkuFunctionConfig<void, Out, "channel" | "rpc" | "session">;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a function that handles WebSocket channel disconnections.
|
|
36
|
+
* Called when a client disconnects from a channel.
|
|
37
|
+
*
|
|
38
|
+
* @param func - Function definition, either direct function or configuration object
|
|
39
|
+
* @returns The normalized configuration object
|
|
40
|
+
*/
|
|
41
|
+
export declare const pikkuChannelDisconnectionFunc: (func: PikkuFunctionSessionless<void, void, "channel"> | PikkuFunctionConfig<void, void, "channel" | "session" | "rpc">) => PikkuFunctionConfig<void, void, "channel" | "rpc" | "session">;
|
|
42
|
+
/**
|
|
43
|
+
* Configuration object for channel functions with Zod schema validation.
|
|
44
|
+
*/
|
|
45
|
+
type PikkuChannelFuncConfigWithSchema<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1 | undefined = undefined> = {
|
|
46
|
+
name?: string;
|
|
47
|
+
tags?: string[];
|
|
48
|
+
expose?: boolean;
|
|
49
|
+
remote?: boolean;
|
|
50
|
+
func: PikkuFunctionSessionless<InferSchemaOutput<InputSchema>, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'channel' | 'session' | 'rpc'>;
|
|
51
|
+
auth?: boolean;
|
|
52
|
+
permissions?: CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>;
|
|
53
|
+
middleware?: PikkuMiddleware[];
|
|
54
|
+
input: InputSchema;
|
|
55
|
+
output?: OutputSchema;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Creates a function that handles WebSocket channel messages.
|
|
59
|
+
* Called when a message is received on a channel.
|
|
60
|
+
*
|
|
61
|
+
* Supports two patterns:
|
|
62
|
+
* 1. Generic types: `pikkuChannelFunc<Input, Output>({ func: ... })`
|
|
63
|
+
* 2. Zod schemas: `pikkuChannelFunc({ input: z.object(...), func: ... })`
|
|
64
|
+
*
|
|
65
|
+
* @template In - Input type for channel messages (inferred from schema if provided)
|
|
66
|
+
* @template Out - Output type for channel responses (inferred from schema if provided)
|
|
67
|
+
* @param func - Function definition, either direct function or configuration object
|
|
68
|
+
* @returns The normalized configuration object
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* // Pattern 1: Using generic types
|
|
73
|
+
* const handleMessage = pikkuChannelFunc<{text: string}, {received: boolean}>({
|
|
74
|
+
* func: async (_services, { text }) => ({ received: true })
|
|
75
|
+
* })
|
|
76
|
+
*
|
|
77
|
+
* // Pattern 2: Using Zod schemas
|
|
78
|
+
* const messageInput = z.object({ text: z.string() })
|
|
79
|
+
* const messageOutput = z.object({ received: z.boolean() })
|
|
80
|
+
*
|
|
81
|
+
* const handleMessage = pikkuChannelFunc({
|
|
82
|
+
* input: messageInput,
|
|
83
|
+
* output: messageOutput,
|
|
84
|
+
* func: async (_services, { text }) => ({ received: true })
|
|
85
|
+
* })
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function pikkuChannelFunc<InputSchema extends StandardSchemaV1, OutputSchema extends StandardSchemaV1 | undefined = undefined>(config: PikkuChannelFuncConfigWithSchema<InputSchema, OutputSchema>): PikkuFunctionConfig<InferSchemaOutput<InputSchema>, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'channel' | 'session' | 'rpc'>;
|
|
89
|
+
export declare function pikkuChannelFunc<In, Out = unknown>(func: PikkuFunctionSessionless<In, Out, 'channel' | 'session' | 'rpc'> | PikkuFunctionConfig<In, Out, 'channel' | 'session' | 'rpc'>): PikkuFunctionConfig<In, Out, 'channel' | 'session' | 'rpc'>;
|
|
90
|
+
/**
|
|
91
|
+
* Registers a WebSocket channel with the Pikku framework.
|
|
92
|
+
*
|
|
93
|
+
* @template ChannelData - Type of data associated with the channel
|
|
94
|
+
* @template Channel - String literal type for the channel name
|
|
95
|
+
* @param channel - Channel definition with connection, disconnection, and message handlers
|
|
96
|
+
*/
|
|
97
|
+
export declare const wireChannel: <ChannelData, Channel extends string>(channel: ChannelWiring<ChannelData, Channel> & AssertHTTPWiringParams<ChannelData, Channel>) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Type-safe helper for defining channel message routes that can be composed.
|
|
100
|
+
* Returns the routes record as-is for use with wireChannel's onMessageWiring.
|
|
101
|
+
*
|
|
102
|
+
* @template T - Record of channel route handlers
|
|
103
|
+
* @param routes - The channel routes record
|
|
104
|
+
* @returns The same routes record (identity function for type safety)
|
|
105
|
+
*/
|
|
106
|
+
export declare function defineChannelRoutes<T extends Record<string, any>>(routes: T): T;
|
|
107
|
+
export type PikkuChannelMiddleware<RequiredServices extends Services = Services, Event = unknown> = CorePikkuChannelMiddleware<RequiredServices, Event>;
|
|
108
|
+
export declare const pikkuChannelMiddleware: <RequiredServices extends Services = Services, Event = unknown>(middleware: PikkuChannelMiddleware<RequiredServices, Event>) => PikkuChannelMiddleware<RequiredServices, Event>;
|
|
109
|
+
export declare const pikkuChannelMiddlewareFactory: <In = any>(factory: CorePikkuChannelMiddlewareFactory<In>) => CorePikkuChannelMiddlewareFactory<In>;
|
|
110
|
+
export declare const addChannelMiddleware: (tag: string, middleware: PikkuChannelMiddleware[]) => CorePikkuChannelMiddleware[];
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=pikku-channel-types.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-channel-types.gen.d.ts","sourceRoot":"","sources":["../../../.pikku/channel/pikku-chann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|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Channel-specific type definitions for tree-shaking optimization
|
|
6
|
+
*/
|
|
7
|
+
import { wireChannel as wireChannelCore, defineChannelRoutes as defineChannelRoutesCore, addChannelMiddleware as addChannelMiddlewareCore } from '@pikku/core/channel';
|
|
8
|
+
/**
|
|
9
|
+
* Creates a function that handles WebSocket channel connections.
|
|
10
|
+
* Called when a client connects to a channel.
|
|
11
|
+
*
|
|
12
|
+
* @template Out - Output type for connection response
|
|
13
|
+
* @param func - Function definition, either direct function or configuration object
|
|
14
|
+
* @returns The normalized configuration object
|
|
15
|
+
*/
|
|
16
|
+
export const pikkuChannelConnectionFunc = (func) => {
|
|
17
|
+
return typeof func === 'function' ? { func } : func;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Creates a function that handles WebSocket channel disconnections.
|
|
21
|
+
* Called when a client disconnects from a channel.
|
|
22
|
+
*
|
|
23
|
+
* @param func - Function definition, either direct function or configuration object
|
|
24
|
+
* @returns The normalized configuration object
|
|
25
|
+
*/
|
|
26
|
+
export const pikkuChannelDisconnectionFunc = (func) => {
|
|
27
|
+
return typeof func === 'function' ? { func } : func;
|
|
28
|
+
};
|
|
29
|
+
export function pikkuChannelFunc(func) {
|
|
30
|
+
return typeof func === 'function' ? { func } : func;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Registers a WebSocket channel with the Pikku framework.
|
|
34
|
+
*
|
|
35
|
+
* @template ChannelData - Type of data associated with the channel
|
|
36
|
+
* @template Channel - String literal type for the channel name
|
|
37
|
+
* @param channel - Channel definition with connection, disconnection, and message handlers
|
|
38
|
+
*/
|
|
39
|
+
export const wireChannel = (channel) => {
|
|
40
|
+
wireChannelCore(channel);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Type-safe helper for defining channel message routes that can be composed.
|
|
44
|
+
* Returns the routes record as-is for use with wireChannel's onMessageWiring.
|
|
45
|
+
*
|
|
46
|
+
* @template T - Record of channel route handlers
|
|
47
|
+
* @param routes - The channel routes record
|
|
48
|
+
* @returns The same routes record (identity function for type safety)
|
|
49
|
+
*/
|
|
50
|
+
export function defineChannelRoutes(routes) {
|
|
51
|
+
return defineChannelRoutesCore(routes);
|
|
52
|
+
}
|
|
53
|
+
export const pikkuChannelMiddleware = (middleware) => {
|
|
54
|
+
return middleware;
|
|
55
|
+
};
|
|
56
|
+
export const pikkuChannelMiddlewareFactory = (factory) => {
|
|
57
|
+
return factory;
|
|
58
|
+
};
|
|
59
|
+
export const addChannelMiddleware = (tag, middleware) => addChannelMiddlewareCore(tag, middleware, '@pikku/addon-ollama');
|
|
60
|
+
//# sourceMappingURL=pikku-channel-types.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-channel-types.gen.js","sourceRoot":"","sources":["../../../.pikku/channel/pikku-channel-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;AAEH,OAAO,EAA8E,WAAW,IAAI,eAAe,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AA6BlP;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,IAEiE,EACjE,EAAE;IACF,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,IAEkE,EAClE,EAAE;IACF,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC,CAAA;AAmED,MAAM,UAAU,gBAAgB,CAAC,IAAS;IACxC,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,OAA2F,EAC3F,EAAE;IACF,eAAe,CAAC,OAAc,CAAC,CAAA;AACjC,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAgC,MAAS;IAC1E,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAA;AACxC,CAAC;AAID,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,UAA2D,EACV,EAAE;IACnD,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,OAA8C,EACP,EAAE;IACzC,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAE,UAAoC,EAAE,EAAE,CACxF,wBAAwB,CAAC,GAAG,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAAA"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.96
|
|
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')
|