@pikku/addon-ollama 0.1.2 → 0.1.4
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/dist/.pikku/addon/pikku-addon-types.gen.d.ts +2 -2
- package/dist/.pikku/addon/pikku-addon-types.gen.js +2 -2
- package/dist/.pikku/addon/pikku-addon-types.gen.ts +2 -2
- package/dist/.pikku/addon/pikku-package.gen.js +3 -2
- package/dist/.pikku/addon/pikku-package.gen.js.map +1 -1
- package/dist/.pikku/addon/pikku-package.gen.ts +4 -2
- package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +8 -2
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.js +3 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.ts +17 -2
- package/dist/.pikku/agent/pikku-model-aliases.gen.d.ts +2 -0
- package/dist/.pikku/agent/pikku-model-aliases.gen.d.ts.map +1 -0
- package/dist/.pikku/agent/pikku-model-aliases.gen.js +6 -0
- package/dist/.pikku/agent/pikku-model-aliases.gen.js.map +1 -0
- package/dist/.pikku/agent/pikku-model-aliases.gen.ts +6 -0
- package/dist/.pikku/agent/pikku-scorer-names.gen.d.ts +8 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.ts +1 -1
- package/dist/.pikku/console/pikku-addon-meta.gen.json +4 -1
- 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 +76 -64
- package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.js +30 -13
- package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.ts +127 -79
- package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +8 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js +2 -2
- package/dist/.pikku/function/pikku-functions-meta.gen.js.map +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +28 -4
- package/dist/.pikku/function/pikku-functions-meta.gen.ts +2 -2
- package/dist/.pikku/function/pikku-functions.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions.gen.ts +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +2 -24
- package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.js +2 -24
- package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.ts +3 -31
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.ts +1 -1
- 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 +2 -1
- package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +2 -1
- package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.ts +2 -1
- package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
- package/dist/.pikku/pikku-meta-service.gen.js +1 -1
- package/dist/.pikku/pikku-meta-service.gen.ts +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +7 -1
- package/dist/.pikku/pikku-services.gen.d.ts.map +1 -1
- package/dist/.pikku/pikku-services.gen.js +6 -0
- package/dist/.pikku/pikku-services.gen.js.map +1 -1
- package/dist/.pikku/pikku-services.gen.ts +7 -1
- 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 +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.ts +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +2 -7
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +2 -7
- package/{.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts → dist/.pikku/rpc/pikku-rpc-wirings-map.remote.gen.d.ts} +2 -7
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +2 -2
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js.map +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +2 -2
- 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 +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.ts +1 -1
- package/dist/.pikku/schemas/register.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.ts +1 -1
- 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 +17 -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 +35 -0
- package/dist/.pikku/workflow/pikku-scenario-step-map.gen.d.ts +18 -0
- package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +263 -5
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +62 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +435 -5
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +2 -2
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +4 -4
- 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 +6 -6
- 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/dist/types/application-types.d.ts +17 -0
- package/package.json +6 -7
- package/.pikku/addon/pikku-addon-types.gen.ts +0 -105
- package/.pikku/addon/pikku-package.gen.ts +0 -11
- package/.pikku/agent/pikku-agent-map.gen.d.ts +0 -4
- package/.pikku/agent/pikku-agent-types.gen.ts +0 -82
- package/.pikku/channel/pikku-channel-types.gen.ts +0 -177
- package/.pikku/console/pikku-addon-meta.gen.json +0 -58
- package/.pikku/console/pikku-node-types.gen.ts +0 -8
- package/.pikku/function/pikku-function-types.gen.ts +0 -754
- package/.pikku/function/pikku-functions-meta-verbose.gen.json +0 -118
- package/.pikku/function/pikku-functions-meta.gen.json +0 -78
- package/.pikku/function/pikku-functions-meta.gen.ts +0 -7
- package/.pikku/function/pikku-functions.gen.ts +0 -14
- package/.pikku/http/pikku-http-types.gen.ts +0 -147
- package/.pikku/mcp/pikku-mcp-types.gen.ts +0 -183
- package/.pikku/pikku-bootstrap.gen.ts +0 -8
- package/.pikku/pikku-meta-service.gen.ts +0 -10
- package/.pikku/pikku-services.gen.ts +0 -45
- package/.pikku/pikku-types.gen.ts +0 -21
- package/.pikku/queue/pikku-queue-types.gen.ts +0 -27
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +0 -211
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +0 -6
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +0 -6
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +0 -25
- package/.pikku/schemas/register.gen.ts +0 -39
- package/.pikku/schemas/schemas/OllamaEmbedInput.schema.json +0 -1
- package/.pikku/schemas/schemas/OllamaEmbedManyInput.schema.json +0 -1
- package/.pikku/schemas/schemas/OllamaEmbedManyOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/OllamaEmbedOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/OllamaGenerateObjectInput.schema.json +0 -1
- package/.pikku/schemas/schemas/OllamaGenerateObjectOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/OllamaGenerateTextInput.schema.json +0 -1
- package/.pikku/schemas/schemas/OllamaGenerateTextOutput.schema.json +0 -1
- package/.pikku/schemas/schemas/VariableSchema_ollama_base_url.schema.json +0 -1
- package/.pikku/secrets/pikku-secret-types.gen.ts +0 -5
- package/.pikku/secrets/pikku-secrets.gen.ts +0 -21
- package/.pikku/trigger/pikku-trigger-types.gen.ts +0 -160
- package/.pikku/variables/pikku-variable-types.gen.ts +0 -5
- package/.pikku/variables/pikku-variables-meta.gen.json +0 -10
- package/.pikku/variables/pikku-variables.gen.ts +0 -23
- package/.pikku/workflow/pikku-workflow-map.gen.d.ts +0 -38
- package/.pikku/workflow/pikku-workflow-types.gen.ts +0 -167
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +0 -9
- package/.pikku/workflow/pikku-workflow-wirings.gen.ts +0 -3
- /package/{.pikku/secrets/pikku-secrets-meta.gen.json → dist/.pikku/scenarios/features.gen.json} +0 -0
|
@@ -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.103
|
|
3
3
|
*/
|
|
4
4
|
import { WorkflowCancelledException } from '@pikku/core/workflow'
|
|
5
5
|
import { template } from '@pikku/core/workflow'
|
|
@@ -9,11 +9,17 @@ import {
|
|
|
9
9
|
type PikkuWorkflowGraphResult,
|
|
10
10
|
} from '@pikku/core/workflow'
|
|
11
11
|
import type { PikkuWorkflowWire, WorkflowStepOptions } from '@pikku/core/workflow'
|
|
12
|
+
import type { PikkuScenarioWire, ScenarioStepOptions } from '@pikku/core/scenario'
|
|
12
13
|
|
|
13
14
|
export { WorkflowCancelledException }
|
|
14
|
-
import type { PikkuFunctionSessionless, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js'
|
|
15
|
+
import type { PikkuFunctionSessionless, PikkuFunctionConfig, WiredServices } from '../function/pikku-function-types.gen.js'
|
|
15
16
|
import type { FlattenedRPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.d.js'
|
|
16
17
|
import type { FlattenedWorkflowMap } from './pikku-workflow-map.gen.d.js'
|
|
18
|
+
import type { AgentMap as FlattenedAgentMap } from '../agent/pikku-agent-map.gen.d.js'
|
|
19
|
+
import type { FlattenedScenarioStepMap } from './pikku-scenario-step-map.gen.d.js'
|
|
20
|
+
import type { TypedPersonas } from './pikku-personas.gen.js'
|
|
21
|
+
|
|
22
|
+
export type { TypedPersonas }
|
|
17
23
|
|
|
18
24
|
export { template }
|
|
19
25
|
|
|
@@ -39,8 +45,43 @@ export interface TypedWorkflow extends PikkuWorkflowWire {
|
|
|
39
45
|
): Promise<T>
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
/**
|
|
49
|
+
* The typed half of a scenario wire: `given`/`when`/`then`, narrowed to the
|
|
50
|
+
* names declared by `pikkuScenarioStep` in this project. `given` and `when`
|
|
51
|
+
* differ only in the prose the reporter renders; `then` additionally makes the
|
|
52
|
+
* step's bindings witnesses rather than alternatives.
|
|
53
|
+
*/
|
|
54
|
+
export interface TypedScenarioSteps {
|
|
55
|
+
given<K extends keyof FlattenedScenarioStepMap>(
|
|
56
|
+
stepName: string,
|
|
57
|
+
stepFunc: K,
|
|
58
|
+
data?: FlattenedScenarioStepMap[K]['input'],
|
|
59
|
+
options?: ScenarioStepOptions
|
|
60
|
+
): Promise<FlattenedScenarioStepMap[K]['output']>
|
|
61
|
+
|
|
62
|
+
when<K extends keyof FlattenedScenarioStepMap>(
|
|
63
|
+
stepName: string,
|
|
64
|
+
stepFunc: K,
|
|
65
|
+
data?: FlattenedScenarioStepMap[K]['input'],
|
|
66
|
+
options?: ScenarioStepOptions
|
|
67
|
+
): Promise<FlattenedScenarioStepMap[K]['output']>
|
|
68
|
+
|
|
69
|
+
then<K extends keyof FlattenedScenarioStepMap>(
|
|
70
|
+
stepName: string,
|
|
71
|
+
stepFunc: K,
|
|
72
|
+
data?: FlattenedScenarioStepMap[K]['input'],
|
|
73
|
+
options?: ScenarioStepOptions
|
|
74
|
+
): Promise<FlattenedScenarioStepMap[K]['output']>
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** `Out` types `scenario.context`. */
|
|
78
|
+
export type TypedScenario<Out = unknown> = TypedWorkflow &
|
|
79
|
+
Omit<PikkuScenarioWire<Out>, keyof PikkuWorkflowWire | keyof TypedScenarioSteps> &
|
|
80
|
+
TypedScenarioSteps
|
|
81
|
+
|
|
42
82
|
import type { StandardSchemaV1 } from '@standard-schema/spec'
|
|
43
83
|
import type { InferSchemaOutput, PikkuPermission, PikkuMiddleware, NodeConfig, PikkuApprovalDescription } from '../function/pikku-function-types.gen.js'
|
|
84
|
+
import type { ScopeId } from '../scopes/pikku-scopes.gen.js'
|
|
44
85
|
import { PikkuError } from '@pikku/core/errors'
|
|
45
86
|
import type { CorePermissionGroup } from '@pikku/core'
|
|
46
87
|
|
|
@@ -49,6 +90,17 @@ export type PikkuFunctionWorkflow<
|
|
|
49
90
|
Out = never
|
|
50
91
|
> = PikkuFunctionSessionless<In, Out, 'workflow'>
|
|
51
92
|
|
|
93
|
+
/**
|
|
94
|
+
* `Ctx` types `scenario.context`, defaulting to the body's own output. A hook
|
|
95
|
+
* returns void but shares the scenario's context, so it passes that scenario's
|
|
96
|
+
* output here instead.
|
|
97
|
+
*/
|
|
98
|
+
export type PikkuFunctionScenario<
|
|
99
|
+
In = unknown,
|
|
100
|
+
Out = never,
|
|
101
|
+
Ctx = Out
|
|
102
|
+
> = PikkuFunctionSessionless<In, Out, 'scenario' | 'actors', WiredServices, Ctx>
|
|
103
|
+
|
|
52
104
|
export type PikkuWorkflowConfigWithSchema<
|
|
53
105
|
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
54
106
|
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
@@ -70,6 +122,11 @@ export type PikkuWorkflowConfigWithSchema<
|
|
|
70
122
|
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown
|
|
71
123
|
>
|
|
72
124
|
auth?: boolean
|
|
125
|
+
/**
|
|
126
|
+
* Scopes the session must hold to run this workflow. All of them are required
|
|
127
|
+
* (AND), and they are checked before `permissions`.
|
|
128
|
+
*/
|
|
129
|
+
scopes?: ScopeId[]
|
|
73
130
|
permissions?: InputSchema extends StandardSchemaV1 ? CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>> : undefined
|
|
74
131
|
middleware?: PikkuMiddleware[]
|
|
75
132
|
input?: InputSchema
|
|
@@ -109,6 +166,365 @@ export function pikkuWorkflowComplexFunc(func: any) {
|
|
|
109
166
|
return typeof func === 'function' ? { func } : func
|
|
110
167
|
}
|
|
111
168
|
|
|
169
|
+
export type PikkuScenarioConfigWithSchema<
|
|
170
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
171
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
172
|
+
> = Omit<PikkuWorkflowConfigWithSchema<InputSchema, OutputSchema>, 'func' | 'auth' | 'scopes' | 'permissions'> & {
|
|
173
|
+
func: PikkuFunctionScenario<
|
|
174
|
+
InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
|
|
175
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown
|
|
176
|
+
>
|
|
177
|
+
/**
|
|
178
|
+
* Runs before the scenario body. Same signature as `func`, but its return
|
|
179
|
+
* value is discarded — a hook is setup, not a step, so it is never recorded
|
|
180
|
+
* on the ladder. Throwing skips the body and fails the run; `after` still
|
|
181
|
+
* runs.
|
|
182
|
+
*/
|
|
183
|
+
before?: PikkuScenarioHook<InputSchema, OutputSchema>
|
|
184
|
+
/**
|
|
185
|
+
* Always runs after the scenario body, in a `finally`, whether it passed or
|
|
186
|
+
* failed. Throwing fails a run that would otherwise have passed; on an
|
|
187
|
+
* already-failed run it attaches as the `cause` and never replaces the
|
|
188
|
+
* original error. Reads `scenario.context` for whatever the body managed to
|
|
189
|
+
* record before it stopped.
|
|
190
|
+
*/
|
|
191
|
+
after?: PikkuScenarioHook<InputSchema, OutputSchema>
|
|
192
|
+
/**
|
|
193
|
+
* Why this scenario is held out of a default run, stated where the scenario
|
|
194
|
+
* is. The scenario still appears in the plan and is reported as skipped
|
|
195
|
+
* rather than quietly omitted; naming it directly with `--flows` runs it
|
|
196
|
+
* anyway.
|
|
197
|
+
*/
|
|
198
|
+
skip?: string
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* A scenario lifecycle hook: the scenario's own `(services, data, wire)`
|
|
203
|
+
* signature with its result discarded. `OutputSchema` types
|
|
204
|
+
* `scenario.context` while the return type stays `void`.
|
|
205
|
+
*/
|
|
206
|
+
export type PikkuScenarioHook<
|
|
207
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
208
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
209
|
+
> = PikkuFunctionScenario<
|
|
210
|
+
InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
|
|
211
|
+
void,
|
|
212
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown
|
|
213
|
+
>
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Declares a scenario hook. Returns the function verbatim — a hook is never
|
|
217
|
+
* registered, so this exists purely to give an inline hook a call site to be
|
|
218
|
+
* contextually typed from, the way every other pikku primitive is.
|
|
219
|
+
*/
|
|
220
|
+
export function pikkuScenarioHook<In = unknown, Ctx = unknown>(
|
|
221
|
+
hook: PikkuFunctionScenario<In, void, Ctx>
|
|
222
|
+
): PikkuFunctionScenario<In, void, Ctx> {
|
|
223
|
+
return hook
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* A scenario: a complex workflow that drives the app the way users do.
|
|
228
|
+
* Steps run as actors over the REAL transport — `scenario.do(step, rpc,
|
|
229
|
+
* data, { actor: actors.yasser })` — so flows double as e2e tests and
|
|
230
|
+
* staged/production health checks (no state reset; scope what you create).
|
|
231
|
+
*/
|
|
232
|
+
export function pikkuScenario<
|
|
233
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
234
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
235
|
+
>(
|
|
236
|
+
config: PikkuScenarioConfigWithSchema<InputSchema, OutputSchema>
|
|
237
|
+
): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'scenario' | 'actors', PikkuFunctionScenario<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown>, InputSchema, OutputSchema>
|
|
238
|
+
export function pikkuScenario<In, Out = unknown>(
|
|
239
|
+
func:
|
|
240
|
+
| PikkuFunctionScenario<In, Out>
|
|
241
|
+
| PikkuFunctionConfig<In, Out, 'scenario' | 'actors', PikkuFunctionScenario<In, Out>>
|
|
242
|
+
): PikkuFunctionConfig<In, Out, 'scenario' | 'actors'>
|
|
243
|
+
export function pikkuScenario(func: any) {
|
|
244
|
+
return typeof func === 'function' ? { func } : func
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* A scenario as a feature references it. Any `pikkuScenario` export is
|
|
249
|
+
* assignable; `In` is recovered from it so the paired form's `data` is
|
|
250
|
+
* checked against that scenario's own input.
|
|
251
|
+
*/
|
|
252
|
+
export type PikkuScenarioRef<In = any, Out = any> = PikkuFunctionConfig<
|
|
253
|
+
In,
|
|
254
|
+
Out,
|
|
255
|
+
'scenario' | 'actors',
|
|
256
|
+
PikkuFunctionScenario<In, Out>,
|
|
257
|
+
any,
|
|
258
|
+
any
|
|
259
|
+
>
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* One entry in a feature's `scenarios` list, validated against itself: a bare
|
|
263
|
+
* scenario, or a scenario paired with the input to run it with. The paired form
|
|
264
|
+
* is gherkin's `Examples:` written as an ordinary loop.
|
|
265
|
+
*/
|
|
266
|
+
export type PikkuFeatureEntry<Entry> = Entry extends {
|
|
267
|
+
scenario: PikkuScenarioRef<infer In>
|
|
268
|
+
}
|
|
269
|
+
? { scenario: PikkuScenarioRef<In>; data: In }
|
|
270
|
+
: Entry extends PikkuScenarioRef
|
|
271
|
+
? Entry
|
|
272
|
+
: never
|
|
273
|
+
|
|
274
|
+
export type PikkuFeatureConfig<Scenarios extends readonly unknown[]> = {
|
|
275
|
+
/** Human-readable name. The export identifier is the id. */
|
|
276
|
+
name: string
|
|
277
|
+
description?: string
|
|
278
|
+
tags?: string[]
|
|
279
|
+
scenarios: { [K in keyof Scenarios]: PikkuFeatureEntry<Scenarios[K]> }
|
|
280
|
+
/**
|
|
281
|
+
* Runs ONCE before the whole group — not before each scenario. Per-scenario
|
|
282
|
+
* setup is the scenario's own `before`; gherkin's `Background:` is
|
|
283
|
+
* deliberately not expressible here.
|
|
284
|
+
*/
|
|
285
|
+
before?: PikkuScenarioHook
|
|
286
|
+
after?: PikkuScenarioHook
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* A feature: an ordered group of scenarios, mirroring gherkin's Feature ↔
|
|
291
|
+
* Scenario structure. Scenarios are referenced by imported identifier, so a
|
|
292
|
+
* renamed or deleted scenario is a compile error rather than a silent skip.
|
|
293
|
+
*
|
|
294
|
+
* A scenario does not have to belong to a feature — a void-input scenario
|
|
295
|
+
* still runs standalone.
|
|
296
|
+
*
|
|
297
|
+
* ```ts
|
|
298
|
+
* export const credentialFeature = pikkuFeature({
|
|
299
|
+
* name: 'Credential API',
|
|
300
|
+
* tags: ['credential'],
|
|
301
|
+
* before: startsMockOAuthServer,
|
|
302
|
+
* after: stopsMockOAuthServer,
|
|
303
|
+
* scenarios: [
|
|
304
|
+
* credentialLazyLoadScenario,
|
|
305
|
+
* ...['stripe', 'google'].map((name) => ({
|
|
306
|
+
* scenario: credentialRoundTripScenario,
|
|
307
|
+
* data: { name },
|
|
308
|
+
* })),
|
|
309
|
+
* ],
|
|
310
|
+
* })
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
export function pikkuFeature<const Scenarios extends readonly unknown[]>(
|
|
314
|
+
config: PikkuFeatureConfig<Scenarios>
|
|
315
|
+
): PikkuFeatureConfig<Scenarios> {
|
|
316
|
+
return config
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* One surface's implementation of a step.
|
|
321
|
+
*
|
|
322
|
+
* Each binding is typed independently, so a browser binding gets a non-optional
|
|
323
|
+
* `wire.browser` and a cli binding a non-optional `wire.cli` without either
|
|
324
|
+
* leaking into the other.
|
|
325
|
+
*/
|
|
326
|
+
export type PikkuFunctionScenarioStep<
|
|
327
|
+
In = unknown,
|
|
328
|
+
Out = never,
|
|
329
|
+
Surface extends 'browser' | 'cli' | 'default' = 'default'
|
|
330
|
+
> = PikkuFunctionSessionless<
|
|
331
|
+
In,
|
|
332
|
+
Out,
|
|
333
|
+
Surface extends 'default' ? 'scenarioStep' : 'scenarioStep' | Surface
|
|
334
|
+
>
|
|
335
|
+
|
|
336
|
+
export type PikkuScenarioStepConfigWithSchema<
|
|
337
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
338
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
339
|
+
> = {
|
|
340
|
+
/** Registered name — this is the string `scenario.given()` references. */
|
|
341
|
+
name: string
|
|
342
|
+
/**
|
|
343
|
+
* What this step does, for the console and for whoever reads the source. It
|
|
344
|
+
* is also the fallback prose when no `template` is declared, in which case a
|
|
345
|
+
* reporter renders "Given the shopper buys an apple". Defaults to the call
|
|
346
|
+
* site's step name.
|
|
347
|
+
*/
|
|
348
|
+
description?: string
|
|
349
|
+
/**
|
|
350
|
+
* The prose a reporter renders for this step, with `{placeholders}` filled
|
|
351
|
+
* from the input the step was called with — `'sees {packageName}'` reports as
|
|
352
|
+
* "Then the admin sees @pikku/addon-todos". Every input field should appear,
|
|
353
|
+
* so the report names the values under test rather than repeating one
|
|
354
|
+
* sentence per call site.
|
|
355
|
+
*/
|
|
356
|
+
template?: string
|
|
357
|
+
title?: string
|
|
358
|
+
tags?: string[]
|
|
359
|
+
input?: InputSchema
|
|
360
|
+
output?: OutputSchema
|
|
361
|
+
errors?: Array<typeof PikkuError>
|
|
362
|
+
/**
|
|
363
|
+
* Drive this step through a real browser, as a human would. The runner
|
|
364
|
+
* provisions a window for the step's actor first — which makes an actor
|
|
365
|
+
* mandatory — and `wire.browser` is non-optional inside it.
|
|
366
|
+
*
|
|
367
|
+
* Compose shared utilities here rather than writing raw clicks: the step says
|
|
368
|
+
* what the actor is doing, the utilities say how.
|
|
369
|
+
*/
|
|
370
|
+
browser?: PikkuFunctionScenarioStep<
|
|
371
|
+
InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
|
|
372
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
373
|
+
'browser'
|
|
374
|
+
>
|
|
375
|
+
/** Drive this step remotely, over the websocket. */
|
|
376
|
+
cli?: PikkuFunctionScenarioStep<
|
|
377
|
+
InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
|
|
378
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
379
|
+
'cli'
|
|
380
|
+
>
|
|
381
|
+
/**
|
|
382
|
+
* The server-side path — the fast suite, and the floor every other surface
|
|
383
|
+
* falls back to.
|
|
384
|
+
*
|
|
385
|
+
* On a `then`, this is not an alternative to the other bindings but a second
|
|
386
|
+
* **witness**: the run executes every binding it has and fails if they
|
|
387
|
+
* disagree, because "the row says paid" and "the page says paid" are different
|
|
388
|
+
* claims and the gap between them is the bug nobody catches.
|
|
389
|
+
*/
|
|
390
|
+
default?: PikkuFunctionScenarioStep<
|
|
391
|
+
InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
|
|
392
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
393
|
+
'default'
|
|
394
|
+
>
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export type PikkuScenarioStepConfig<In, Out> =
|
|
398
|
+
Omit<PikkuScenarioStepConfigWithSchema<undefined, undefined>, 'browser' | 'cli' | 'default' | 'input' | 'output'> & {
|
|
399
|
+
browser?: PikkuFunctionScenarioStep<In, Out, 'browser'>
|
|
400
|
+
cli?: PikkuFunctionScenarioStep<In, Out, 'cli'>
|
|
401
|
+
default?: PikkuFunctionScenarioStep<In, Out, 'default'>
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* A named, reusable scenario step, declaring one implementation per surface an
|
|
406
|
+
* actor can drive it through.
|
|
407
|
+
*
|
|
408
|
+
* The step's identity is what the actor is trying to do; which surface carries
|
|
409
|
+
* it out is a binding. That is what lets one ladder run through a real browser,
|
|
410
|
+
* over the websocket, or entirely server-side — and what makes "how much of this
|
|
411
|
+
* flow can a human actually reach" a number rather than a guess.
|
|
412
|
+
*
|
|
413
|
+
* Steps are deliberately NOT registered as RPCs: a browser-driving step must
|
|
414
|
+
* never be network-callable.
|
|
415
|
+
*/
|
|
416
|
+
export function pikkuScenarioStep<
|
|
417
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
418
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
419
|
+
>(
|
|
420
|
+
config: PikkuScenarioStepConfigWithSchema<InputSchema, OutputSchema>
|
|
421
|
+
): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'scenarioStep' | 'browser' | 'cli', PikkuFunctionScenarioStep<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'browser' | 'cli' | 'default'>, InputSchema, OutputSchema>
|
|
422
|
+
export function pikkuScenarioStep<In, Out = unknown>(
|
|
423
|
+
config: PikkuScenarioStepConfig<In, Out>
|
|
424
|
+
): PikkuFunctionConfig<In, Out, 'scenarioStep' | 'browser' | 'cli'>
|
|
425
|
+
export function pikkuScenarioStep(config: any) {
|
|
426
|
+
const surfaces = (['browser', 'cli', 'default'] as const).filter(
|
|
427
|
+
(surface) => typeof config[surface] === 'function'
|
|
428
|
+
)
|
|
429
|
+
if (surfaces.length === 0) {
|
|
430
|
+
throw new Error(
|
|
431
|
+
`[scenario] step '${config.name}' declares no surface bindings. Add at least a \`default\` (server-side) implementation.`
|
|
432
|
+
)
|
|
433
|
+
}
|
|
434
|
+
return {
|
|
435
|
+
...config,
|
|
436
|
+
surfaces,
|
|
437
|
+
// The runner sets the surface on the wire and calls this once per binding it
|
|
438
|
+
// resolved — every witness of a `then`, exactly one for an action step.
|
|
439
|
+
func: (services: any, data: any, wire: any) => {
|
|
440
|
+
const surface = wire?.scenarioStep?.surface ?? 'default'
|
|
441
|
+
const binding = config[surface] ?? config.default
|
|
442
|
+
return binding(services, data, wire)
|
|
443
|
+
},
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* What a step declares when nobody drives it: one implementation, and no
|
|
449
|
+
* surfaces to choose between.
|
|
450
|
+
*
|
|
451
|
+
* `func` rather than `default` is the point. `default` means *the fallback when
|
|
452
|
+
* no other surface applies*, which implies others could exist; `func` says
|
|
453
|
+
* structurally that there is one way this happens. That also keeps the phase
|
|
454
|
+
* rule coherent — an assertion runs every witness it has and fails if they
|
|
455
|
+
* disagree, and this has exactly one by construction.
|
|
456
|
+
*/
|
|
457
|
+
export type PikkuSubjectScenarioStepConfigWithSchema<
|
|
458
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
459
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
460
|
+
> = Omit<
|
|
461
|
+
PikkuScenarioStepConfigWithSchema<InputSchema, OutputSchema>,
|
|
462
|
+
'browser' | 'cli' | 'default'
|
|
463
|
+
> & {
|
|
464
|
+
func: PikkuFunctionScenarioStep<
|
|
465
|
+
InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown,
|
|
466
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
467
|
+
'default'
|
|
468
|
+
>
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export type PikkuSubjectScenarioStepConfig<In, Out> =
|
|
472
|
+
Omit<PikkuScenarioStepConfig<In, Out>, 'browser' | 'cli' | 'default'> & {
|
|
473
|
+
func: PikkuFunctionScenarioStep<In, Out, 'default'>
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* A step in which the app acts on itself — "Given the platform has expired the
|
|
478
|
+
* trial".
|
|
479
|
+
*
|
|
480
|
+
* The grammatical subject of that sentence is not a user of your app; it **is**
|
|
481
|
+
* your app, which is why it is its own declaration rather than a persona with an
|
|
482
|
+
* asterisk. A persona is a person.
|
|
483
|
+
*
|
|
484
|
+
* Local-test-only, and never in a virtual user's catalogue: a virtual user that
|
|
485
|
+
* could expire its own trial is manufacturing the outcome it exists to discover.
|
|
486
|
+
*/
|
|
487
|
+
export function pikkuPlatformScenarioStep<
|
|
488
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
489
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
490
|
+
>(
|
|
491
|
+
config: PikkuSubjectScenarioStepConfigWithSchema<InputSchema, OutputSchema>
|
|
492
|
+
): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'scenarioStep', PikkuFunctionScenarioStep<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'default'>, InputSchema, OutputSchema>
|
|
493
|
+
export function pikkuPlatformScenarioStep<In, Out = unknown>(
|
|
494
|
+
config: PikkuSubjectScenarioStepConfig<In, Out>
|
|
495
|
+
): PikkuFunctionConfig<In, Out, 'scenarioStep'>
|
|
496
|
+
export function pikkuPlatformScenarioStep(config: any) {
|
|
497
|
+
return { ...config, surfaces: ['default'] }
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* A step in which a third-party system acts — "Given Stripe's webhook arrives",
|
|
502
|
+
* "When Mailgun bounces it".
|
|
503
|
+
*
|
|
504
|
+
* `addon` names the addon that wraps that service, the same name its
|
|
505
|
+
* `wireAddon` declares. These steps *are* the mock its consumers currently
|
|
506
|
+
* hand-write: shipped by the addon author, maintained with the addon, and the
|
|
507
|
+
* same artifact that appears in the prose.
|
|
508
|
+
*
|
|
509
|
+
* Note that arranging and asserting are different — "Stripe's webhook arrives"
|
|
510
|
+
* stubs, "Then Stripe was charged" asserts, and only the first is a stub.
|
|
511
|
+
*
|
|
512
|
+
* Local-test-only, and never in a virtual user's catalogue: one that could
|
|
513
|
+
* invoke this would forge its own payment success.
|
|
514
|
+
*/
|
|
515
|
+
export function pikkuAddonScenarioStep<
|
|
516
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
517
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
518
|
+
>(
|
|
519
|
+
config: PikkuSubjectScenarioStepConfigWithSchema<InputSchema, OutputSchema> & { addon: string }
|
|
520
|
+
): PikkuFunctionConfig<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'scenarioStep', PikkuFunctionScenarioStep<InputSchema extends StandardSchemaV1 ? InferSchemaOutput<InputSchema> : unknown, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'default'>, InputSchema, OutputSchema>
|
|
521
|
+
export function pikkuAddonScenarioStep<In, Out = unknown>(
|
|
522
|
+
config: PikkuSubjectScenarioStepConfig<In, Out> & { addon: string }
|
|
523
|
+
): PikkuFunctionConfig<In, Out, 'scenarioStep'>
|
|
524
|
+
export function pikkuAddonScenarioStep(config: any) {
|
|
525
|
+
return { ...config, surfaces: ['default'] }
|
|
526
|
+
}
|
|
527
|
+
|
|
112
528
|
type TypedRef<T> = { $ref: string; path?: string } & { __phantomType?: T }
|
|
113
529
|
|
|
114
530
|
type TemplateString = {
|
|
@@ -125,13 +541,19 @@ type InputWithRefs<T> = {
|
|
|
125
541
|
type NodeInputType<FuncMap extends Record<string, string>, K extends keyof FuncMap> =
|
|
126
542
|
FuncMap[K] extends keyof FlattenedRPCMap
|
|
127
543
|
? InputWithRefs<FlattenedRPCMap[FuncMap[K]]['input']>
|
|
128
|
-
:
|
|
544
|
+
: FuncMap[K] extends keyof FlattenedWorkflowMap
|
|
545
|
+
? InputWithRefs<FlattenedWorkflowMap[FuncMap[K]]['input']>
|
|
546
|
+
: Record<string, unknown>
|
|
129
547
|
|
|
130
548
|
type NodeOutputKeys<FuncMap extends Record<string, string>, N extends string> =
|
|
131
549
|
N extends keyof FuncMap
|
|
132
550
|
? FuncMap[N] extends keyof FlattenedRPCMap
|
|
133
551
|
? keyof FlattenedRPCMap[FuncMap[N]]['output'] & string
|
|
134
|
-
:
|
|
552
|
+
: FuncMap[N] extends keyof FlattenedWorkflowMap
|
|
553
|
+
? keyof FlattenedWorkflowMap[FuncMap[N]]['output'] & string
|
|
554
|
+
: FuncMap[N] extends keyof FlattenedAgentMap
|
|
555
|
+
? keyof FlattenedAgentMap[FuncMap[N]]['output'] & string
|
|
556
|
+
: string
|
|
135
557
|
: string
|
|
136
558
|
|
|
137
559
|
type RefFunction<FuncMap extends Record<string, string>> = {
|
|
@@ -139,6 +561,7 @@ type RefFunction<FuncMap extends Record<string, string>> = {
|
|
|
139
561
|
nodeId: N,
|
|
140
562
|
path: NodeOutputKeys<FuncMap, N>
|
|
141
563
|
): TypedRef<unknown>
|
|
564
|
+
<N extends Extract<keyof FuncMap, string>>(nodeId: N): TypedRef<unknown>
|
|
142
565
|
(nodeId: 'trigger' | '$item', path?: string): TypedRef<unknown>
|
|
143
566
|
}
|
|
144
567
|
|
|
@@ -152,13 +575,20 @@ type GraphNodeConfigMap<FuncMap extends Record<string, string>> = {
|
|
|
152
575
|
| (() => NodeInputType<FuncMap, K>)
|
|
153
576
|
| ((ref: RefFunction<FuncMap>, template: TemplateFunction) => NodeInputType<FuncMap, K>)
|
|
154
577
|
onError?: Extract<keyof FuncMap, string> | Extract<keyof FuncMap, string>[]
|
|
578
|
+
/** Free-text node documentation. Non-semantic — excluded from graphHash. */
|
|
579
|
+
notes?: string
|
|
155
580
|
}
|
|
156
581
|
}
|
|
157
582
|
|
|
158
583
|
type NextConfig<NodeIds extends string> = NodeIds | NodeIds[] | { if: string; then: NodeIds; else?: NodeIds }
|
|
159
584
|
|
|
160
585
|
export function pikkuWorkflowGraph<
|
|
161
|
-
const FuncMap extends Record<
|
|
586
|
+
const FuncMap extends Record<
|
|
587
|
+
string,
|
|
588
|
+
| (keyof FlattenedRPCMap & string)
|
|
589
|
+
| (keyof FlattenedWorkflowMap & string)
|
|
590
|
+
| (keyof FlattenedAgentMap & string)
|
|
591
|
+
>
|
|
162
592
|
>(
|
|
163
593
|
config: PikkuWorkflowGraphConfig<FuncMap, GraphNodeConfigMap<FuncMap>>
|
|
164
594
|
): PikkuWorkflowGraphResult {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.103
|
|
3
3
|
*/
|
|
4
|
-
import { pikkuState } from '@pikku/core/
|
|
4
|
+
import { pikkuState } from '@pikku/core/ecosystem';
|
|
5
5
|
const workflowsMeta = {};
|
|
6
6
|
pikkuState('@pikku/addon-ollama', 'workflows', 'meta', workflowsMeta);
|
|
7
7
|
//# sourceMappingURL=pikku-workflow-wirings-meta.gen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pikku-workflow-wirings-meta.gen.js","sourceRoot":"","sources":["../../../.pikku/workflow/pikku-workflow-wirings-meta.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pikku-workflow-wirings-meta.gen.js","sourceRoot":"","sources":["../../../.pikku/workflow/pikku-workflow-wirings-meta.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGlD,MAAM,aAAa,GAAyB,EAAE,CAAA;AAE9C,UAAU,CAAC,qBAAqB,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.103
|
|
3
3
|
*/
|
|
4
|
-
import { pikkuState } from '@pikku/core/
|
|
5
|
-
import type {
|
|
4
|
+
import { pikkuState } from '@pikku/core/ecosystem'
|
|
5
|
+
import type { WorkflowsRuntimeMeta } from '@pikku/core/workflow/types'
|
|
6
6
|
|
|
7
|
-
const workflowsMeta:
|
|
7
|
+
const workflowsMeta: WorkflowsRuntimeMeta = {}
|
|
8
8
|
|
|
9
9
|
pikkuState('@pikku/addon-ollama', 'workflows', 'meta', workflowsMeta)
|
|
@@ -28,7 +28,7 @@ export declare const ollamaEmbedMany: import("#pikku").PikkuFunctionConfig<{
|
|
|
28
28
|
usage: {
|
|
29
29
|
tokens: number;
|
|
30
30
|
};
|
|
31
|
-
}, "rpc" | "session", import("#pikku").
|
|
31
|
+
}, "rpc" | "session", import("#pikku").WiredServices, unknown> | import("#pikku").PikkuFunction<{
|
|
32
32
|
model: string;
|
|
33
33
|
values: string[];
|
|
34
34
|
}, {
|
|
@@ -36,5 +36,5 @@ export declare const ollamaEmbedMany: import("#pikku").PikkuFunctionConfig<{
|
|
|
36
36
|
usage: {
|
|
37
37
|
tokens: number;
|
|
38
38
|
};
|
|
39
|
-
}, "rpc" | "session", import("#pikku").
|
|
39
|
+
}, "rpc" | "session", import("#pikku").WiredServices>, undefined, undefined>;
|
|
40
40
|
//# sourceMappingURL=embed-many.function.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed-many.function.d.ts","sourceRoot":"","sources":["../../../../src/functions/embeddings/embed-many.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAA;AAEF,eAAO,MAAM,WAAW;;iBAEtB,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;iBAGhC,CAAA;AAIF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"embed-many.function.d.ts","sourceRoot":"","sources":["../../../../src/functions/embeddings/embed-many.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAA;AAEF,eAAO,MAAM,WAAW;;iBAEtB,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;iBAGhC,CAAA;AAIF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;4EAe1B,CAAA"}
|
|
@@ -28,7 +28,7 @@ export declare const ollamaEmbed: import("#pikku").PikkuFunctionConfig<{
|
|
|
28
28
|
usage: {
|
|
29
29
|
tokens: number;
|
|
30
30
|
};
|
|
31
|
-
}, "rpc" | "session", import("#pikku").
|
|
31
|
+
}, "rpc" | "session", import("#pikku").WiredServices, unknown> | import("#pikku").PikkuFunction<{
|
|
32
32
|
model: string;
|
|
33
33
|
value: string;
|
|
34
34
|
}, {
|
|
@@ -36,5 +36,5 @@ export declare const ollamaEmbed: import("#pikku").PikkuFunctionConfig<{
|
|
|
36
36
|
usage: {
|
|
37
37
|
tokens: number;
|
|
38
38
|
};
|
|
39
|
-
}, "rpc" | "session", import("#pikku").
|
|
39
|
+
}, "rpc" | "session", import("#pikku").WiredServices>, undefined, undefined>;
|
|
40
40
|
//# sourceMappingURL=embed.function.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.function.d.ts","sourceRoot":"","sources":["../../../../src/functions/embeddings/embed.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAA;AAEF,eAAO,MAAM,WAAW;;iBAEtB,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;iBAG5B,CAAA;AAIF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"embed.function.d.ts","sourceRoot":"","sources":["../../../../src/functions/embeddings/embed.function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAA;AAEF,eAAO,MAAM,WAAW;;iBAEtB,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;iBAG5B,CAAA;AAIF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;4EAetB,CAAA"}
|
|
@@ -23,9 +23,9 @@ export declare const OllamaGenerateObjectInput: z.ZodObject<{
|
|
|
23
23
|
schemaName: z.ZodOptional<z.ZodString>;
|
|
24
24
|
schemaDescription: z.ZodOptional<z.ZodString>;
|
|
25
25
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
json: "json";
|
|
26
27
|
auto: "auto";
|
|
27
28
|
tool: "tool";
|
|
28
|
-
json: "json";
|
|
29
29
|
}>>;
|
|
30
30
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
31
31
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
@@ -55,7 +55,7 @@ export declare const ollamaGenerateObject: import("#pikku").PikkuFunctionConfig<
|
|
|
55
55
|
system?: string | undefined;
|
|
56
56
|
schemaName?: string | undefined;
|
|
57
57
|
schemaDescription?: string | undefined;
|
|
58
|
-
mode?: "
|
|
58
|
+
mode?: "json" | "auto" | "tool" | undefined;
|
|
59
59
|
maxTokens?: number | undefined;
|
|
60
60
|
temperature?: number | undefined;
|
|
61
61
|
}, {
|
|
@@ -77,7 +77,7 @@ export declare const ollamaGenerateObject: import("#pikku").PikkuFunctionConfig<
|
|
|
77
77
|
system?: string | undefined;
|
|
78
78
|
schemaName?: string | undefined;
|
|
79
79
|
schemaDescription?: string | undefined;
|
|
80
|
-
mode?: "
|
|
80
|
+
mode?: "json" | "auto" | "tool" | undefined;
|
|
81
81
|
maxTokens?: number | undefined;
|
|
82
82
|
temperature?: number | undefined;
|
|
83
83
|
}, {
|
|
@@ -88,7 +88,7 @@ export declare const ollamaGenerateObject: import("#pikku").PikkuFunctionConfig<
|
|
|
88
88
|
completionTokens: number;
|
|
89
89
|
totalTokens: number;
|
|
90
90
|
};
|
|
91
|
-
}, "rpc" | "session", import("#pikku").
|
|
91
|
+
}, "rpc" | "session", import("#pikku").WiredServices, unknown> | import("#pikku").PikkuFunction<{
|
|
92
92
|
model: string;
|
|
93
93
|
schema: Record<string, any>;
|
|
94
94
|
prompt?: string | undefined;
|
|
@@ -99,7 +99,7 @@ export declare const ollamaGenerateObject: import("#pikku").PikkuFunctionConfig<
|
|
|
99
99
|
system?: string | undefined;
|
|
100
100
|
schemaName?: string | undefined;
|
|
101
101
|
schemaDescription?: string | undefined;
|
|
102
|
-
mode?: "
|
|
102
|
+
mode?: "json" | "auto" | "tool" | undefined;
|
|
103
103
|
maxTokens?: number | undefined;
|
|
104
104
|
temperature?: number | undefined;
|
|
105
105
|
}, {
|
|
@@ -110,5 +110,5 @@ export declare const ollamaGenerateObject: import("#pikku").PikkuFunctionConfig<
|
|
|
110
110
|
completionTokens: number;
|
|
111
111
|
totalTokens: number;
|
|
112
112
|
};
|
|
113
|
-
}, "rpc" | "session", import("#pikku").
|
|
113
|
+
}, "rpc" | "session", import("#pikku").WiredServices>, undefined, undefined>;
|
|
114
114
|
//# sourceMappingURL=generate-object.function.d.ts.map
|