@pikku/addon-execution 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pikku/addon/pikku-addon-types.gen.ts +105 -0
- package/.pikku/addon/pikku-package.gen.ts +9 -0
- package/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
- package/.pikku/agent/pikku-agent-types.gen.ts +82 -0
- package/.pikku/channel/pikku-channel-types.gen.ts +177 -0
- package/.pikku/console/pikku-addon-meta.gen.json +36 -0
- package/.pikku/console/pikku-node-types.gen.ts +8 -0
- package/.pikku/function/pikku-function-types.gen.ts +754 -0
- package/.pikku/function/pikku-functions-meta-verbose.gen.json +56 -0
- package/.pikku/function/pikku-functions-meta.gen.json +40 -0
- package/.pikku/function/pikku-functions-meta.gen.ts +7 -0
- package/.pikku/function/pikku-functions.gen.ts +10 -0
- package/.pikku/http/pikku-http-types.gen.ts +147 -0
- package/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
- package/.pikku/pikku-bootstrap.gen.ts +8 -0
- package/.pikku/pikku-meta-service.gen.ts +10 -0
- package/.pikku/pikku-services.gen.ts +41 -0
- package/.pikku/pikku-types.gen.ts +21 -0
- package/.pikku/queue/pikku-queue-types.gen.ts +27 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +128 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +130 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +4 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
- package/.pikku/schemas/register.gen.ts +19 -0
- package/.pikku/schemas/schemas/ExecuteInput.schema.json +1 -0
- package/.pikku/schemas/schemas/ExecuteOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/SpawnCommandInput.schema.json +1 -0
- package/.pikku/schemas/schemas/SpawnCommandOutput.schema.json +1 -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 +21 -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 +1 -0
- package/.pikku/variables/pikku-variables.gen.ts +21 -0
- package/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
- package/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
- package/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
- package/README.md +16 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +65 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.js +78 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.ts +105 -0
- package/dist/.pikku/addon/pikku-package.gen.d.ts +2 -0
- package/dist/.pikku/addon/pikku-package.gen.d.ts.map +1 -0
- package/dist/.pikku/addon/pikku-package.gen.js +9 -0
- package/dist/.pikku/addon/pikku-package.gen.js.map +1 -0
- package/dist/.pikku/addon/pikku-package.gen.ts +9 -0
- package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +47 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.js +18 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.ts +82 -0
- 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 +36 -0
- package/dist/.pikku/console/pikku-node-types.gen.d.ts +7 -0
- package/dist/.pikku/console/pikku-node-types.gen.d.ts.map +1 -0
- package/dist/.pikku/console/pikku-node-types.gen.js +2 -0
- package/dist/.pikku/console/pikku-node-types.gen.js.map +1 -0
- package/dist/.pikku/console/pikku-node-types.gen.ts +8 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +490 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -0
- package/dist/.pikku/function/pikku-function-types.gen.js +334 -0
- package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -0
- package/dist/.pikku/function/pikku-function-types.gen.ts +754 -0
- package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +56 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.d.ts +2 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.d.ts.map +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js +7 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js.map +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.json +40 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.ts +7 -0
- package/dist/.pikku/function/pikku-functions.gen.d.ts +2 -0
- package/dist/.pikku/function/pikku-functions.gen.d.ts.map +1 -0
- package/dist/.pikku/function/pikku-functions.gen.js +10 -0
- package/dist/.pikku/function/pikku-functions.gen.js.map +1 -0
- package/dist/.pikku/function/pikku-functions.gen.ts +10 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +120 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -0
- package/dist/.pikku/http/pikku-http-types.gen.js +72 -0
- package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -0
- package/dist/.pikku/http/pikku-http-types.gen.ts +147 -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.gen.d.ts +9 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-bootstrap.gen.js +9 -0
- package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -0
- package/dist/.pikku/pikku-bootstrap.gen.ts +8 -0
- 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 +34 -0
- package/dist/.pikku/pikku-services.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-services.gen.js +29 -0
- package/dist/.pikku/pikku-services.gen.js.map +1 -0
- package/dist/.pikku/pikku-services.gen.ts +41 -0
- package/dist/.pikku/pikku-types.gen.d.ts +12 -0
- package/dist/.pikku/pikku-types.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-types.gen.js +17 -0
- package/dist/.pikku/pikku-types.gen.js.map +1 -0
- package/dist/.pikku/pikku-types.gen.ts +21 -0
- 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 +128 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +130 -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 +4 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -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.d.ts +2 -0
- package/dist/.pikku/schemas/register.gen.d.ts.map +1 -0
- package/dist/.pikku/schemas/register.gen.js +13 -0
- package/dist/.pikku/schemas/register.gen.js.map +1 -0
- package/dist/.pikku/schemas/register.gen.ts +19 -0
- package/dist/.pikku/schemas/schemas/ExecuteInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/ExecuteOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/SpawnCommandInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/SpawnCommandOutput.schema.json +1 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +6 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts.map +1 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +5 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.js.map +1 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
- package/dist/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +12 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts.map +1 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.js +11 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.js.map +1 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.ts +21 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +114 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts.map +1 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +34 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js.map +1 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +6 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts.map +1 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.js +5 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.js.map +1 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.ts +5 -0
- package/dist/.pikku/variables/pikku-variables-meta.gen.json +1 -0
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +12 -0
- package/dist/.pikku/variables/pikku-variables.gen.d.ts.map +1 -0
- package/dist/.pikku/variables/pikku-variables.gen.js +11 -0
- package/dist/.pikku/variables/pikku-variables.gen.js.map +1 -0
- package/dist/.pikku/variables/pikku-variables.gen.ts +21 -0
- package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +90 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +18 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts +2 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +7 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +5 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +5 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
- package/dist/src/functions/execute.function.d.ts +37 -0
- package/dist/src/functions/execute.function.d.ts.map +1 -0
- package/dist/src/functions/execute.function.js +31 -0
- package/dist/src/functions/execute.function.js.map +1 -0
- package/dist/src/functions/spawn.function.d.ts +41 -0
- package/dist/src/functions/spawn.function.d.ts.map +1 -0
- package/dist/src/functions/spawn.function.js +38 -0
- package/dist/src/functions/spawn.function.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/services.d.ts +2 -0
- package/dist/src/services.d.ts.map +1 -0
- package/dist/src/services.js +5 -0
- package/dist/src/services.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* This provides the structure needed for typescript to be aware of RPCs and their return types
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export type ExecuteInput = {
|
|
13
|
+
/** The shell command to run */
|
|
14
|
+
command: string;
|
|
15
|
+
/** Working directory for the command */
|
|
16
|
+
cwd?: string | undefined;
|
|
17
|
+
/** Kill the command if it runs longer than this many milliseconds */
|
|
18
|
+
timeout?: number | undefined;
|
|
19
|
+
}
|
|
20
|
+
export type ExecuteOutput = {
|
|
21
|
+
/** Standard output */
|
|
22
|
+
stdout: string;
|
|
23
|
+
/** Standard error */
|
|
24
|
+
stderr: string;
|
|
25
|
+
/** Process exit code (0 on success) */
|
|
26
|
+
exitCode: number;
|
|
27
|
+
}
|
|
28
|
+
export type SpawnCommandInput = {
|
|
29
|
+
/** The program to run (no shell interpretation) */
|
|
30
|
+
command: string;
|
|
31
|
+
/** Arguments passed to the program */
|
|
32
|
+
args?: string[] | undefined;
|
|
33
|
+
/** Working directory for the process */
|
|
34
|
+
cwd?: string | undefined;
|
|
35
|
+
/** Kill the process if it runs longer than this many milliseconds */
|
|
36
|
+
timeout?: number | undefined;
|
|
37
|
+
}
|
|
38
|
+
export type SpawnCommandOutput = {
|
|
39
|
+
/** Standard output */
|
|
40
|
+
stdout: string;
|
|
41
|
+
/** Standard error */
|
|
42
|
+
stderr: string;
|
|
43
|
+
/** Process exit code (0 on success) */
|
|
44
|
+
exitCode: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface RPCHandler<I, O> {
|
|
48
|
+
input: I;
|
|
49
|
+
output: O;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type RPCMap = {
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
// No addon packages, use RPCMap directly
|
|
58
|
+
export type FlattenedRPCMap = RPCMap
|
|
59
|
+
|
|
60
|
+
type IsAny<T> = 0 extends (1 & T) ? true : false
|
|
61
|
+
type IsVoidishInput<T> = IsAny<T> extends true
|
|
62
|
+
? false
|
|
63
|
+
: [T] extends [void | null | undefined]
|
|
64
|
+
? true
|
|
65
|
+
: false
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
export type RPCInvoke = <Name extends keyof FlattenedRPCMap>(
|
|
69
|
+
...args: IsVoidishInput<FlattenedRPCMap[Name]['input']> extends true
|
|
70
|
+
? [name: Name]
|
|
71
|
+
: [name: Name, data: FlattenedRPCMap[Name]['input']]
|
|
72
|
+
) => Promise<FlattenedRPCMap[Name]['output']>
|
|
73
|
+
|
|
74
|
+
export type RPCRemote = <Name extends keyof FlattenedRPCMap>(
|
|
75
|
+
...args: IsVoidishInput<FlattenedRPCMap[Name]['input']> extends true
|
|
76
|
+
? [name: Name]
|
|
77
|
+
: [name: Name, data: FlattenedRPCMap[Name]['input']]
|
|
78
|
+
) => Promise<FlattenedRPCMap[Name]['output']>
|
|
79
|
+
|
|
80
|
+
import type { FlattenedWorkflowMap } from '../workflow/pikku-workflow-map.gen.d.js'
|
|
81
|
+
|
|
82
|
+
import type { AgentMap } from '../agent/pikku-agent-map.gen.d.js'
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
type FlattenedAgentMap = AgentMap
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
import type { PikkuRPC } from '@pikku/core/rpc'
|
|
89
|
+
|
|
90
|
+
interface AIAgentInput {
|
|
91
|
+
message: string
|
|
92
|
+
threadId: string
|
|
93
|
+
resourceId: string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type TypedStartWorkflow = <Name extends keyof FlattenedWorkflowMap>(
|
|
97
|
+
name: Name,
|
|
98
|
+
input: FlattenedWorkflowMap[Name]['input'],
|
|
99
|
+
options?: { startNode?: string }
|
|
100
|
+
) => Promise<{ runId: string }>
|
|
101
|
+
|
|
102
|
+
export type TypedRunWorkflow = <Name extends keyof FlattenedWorkflowMap>(
|
|
103
|
+
name: Name,
|
|
104
|
+
input: FlattenedWorkflowMap[Name]['input']
|
|
105
|
+
) => Promise<FlattenedWorkflowMap[Name]['output']>
|
|
106
|
+
|
|
107
|
+
export type TypedWorkflowStatus = (
|
|
108
|
+
workflowName: string,
|
|
109
|
+
runId: string
|
|
110
|
+
) => Promise<{ id: string; status: 'running' | 'suspended' | 'completed' | 'failed' | 'cancelled'; output?: unknown; error?: { message?: string } }>
|
|
111
|
+
|
|
112
|
+
type TypedAgentRun = [keyof FlattenedAgentMap] extends [never]
|
|
113
|
+
? (name: string, input: AIAgentInput) => Promise<any>
|
|
114
|
+
: <Name extends keyof FlattenedAgentMap>(
|
|
115
|
+
name: Name,
|
|
116
|
+
input: AIAgentInput
|
|
117
|
+
) => Promise<{ runId: string; result: FlattenedAgentMap[Name]['output']; usage: { inputTokens: number; outputTokens: number } }>
|
|
118
|
+
|
|
119
|
+
type TypedAgentStream = [keyof FlattenedAgentMap] extends [never]
|
|
120
|
+
? (name: string, input: AIAgentInput, options?: { requiresToolApproval?: 'all' | 'explicit' | false }) => Promise<void>
|
|
121
|
+
: <Name extends keyof FlattenedAgentMap>(
|
|
122
|
+
name: Name,
|
|
123
|
+
input: AIAgentInput,
|
|
124
|
+
options?: { requiresToolApproval?: 'all' | 'explicit' | false }
|
|
125
|
+
) => Promise<void>
|
|
126
|
+
|
|
127
|
+
export type TypedPikkuRPC = PikkuRPC<RPCInvoke, RPCRemote, TypedStartWorkflow, TypedAgentRun, TypedAgentStream>
|
|
128
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* This provides the structure needed for typescript to be aware of RPCs and their return types
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export type ExecuteInput = {
|
|
13
|
+
/** The shell command to run */
|
|
14
|
+
command: string;
|
|
15
|
+
/** Working directory for the command */
|
|
16
|
+
cwd?: string | undefined;
|
|
17
|
+
/** Kill the command if it runs longer than this many milliseconds */
|
|
18
|
+
timeout?: number | undefined;
|
|
19
|
+
}
|
|
20
|
+
export type ExecuteOutput = {
|
|
21
|
+
/** Standard output */
|
|
22
|
+
stdout: string;
|
|
23
|
+
/** Standard error */
|
|
24
|
+
stderr: string;
|
|
25
|
+
/** Process exit code (0 on success) */
|
|
26
|
+
exitCode: number;
|
|
27
|
+
}
|
|
28
|
+
export type SpawnCommandInput = {
|
|
29
|
+
/** The program to run (no shell interpretation) */
|
|
30
|
+
command: string;
|
|
31
|
+
/** Arguments passed to the program */
|
|
32
|
+
args?: string[] | undefined;
|
|
33
|
+
/** Working directory for the process */
|
|
34
|
+
cwd?: string | undefined;
|
|
35
|
+
/** Kill the process if it runs longer than this many milliseconds */
|
|
36
|
+
timeout?: number | undefined;
|
|
37
|
+
}
|
|
38
|
+
export type SpawnCommandOutput = {
|
|
39
|
+
/** Standard output */
|
|
40
|
+
stdout: string;
|
|
41
|
+
/** Standard error */
|
|
42
|
+
stderr: string;
|
|
43
|
+
/** Process exit code (0 on success) */
|
|
44
|
+
exitCode: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface RPCHandler<I, O> {
|
|
48
|
+
input: I;
|
|
49
|
+
output: O;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type RPCMap = {
|
|
53
|
+
readonly 'execute': RPCHandler<ExecuteInput, ExecuteOutput>,
|
|
54
|
+
readonly 'spawnCommand': RPCHandler<SpawnCommandInput, SpawnCommandOutput>,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// No addon packages, use RPCMap directly
|
|
60
|
+
export type FlattenedRPCMap = RPCMap
|
|
61
|
+
|
|
62
|
+
type IsAny<T> = 0 extends (1 & T) ? true : false
|
|
63
|
+
type IsVoidishInput<T> = IsAny<T> extends true
|
|
64
|
+
? false
|
|
65
|
+
: [T] extends [void | null | undefined]
|
|
66
|
+
? true
|
|
67
|
+
: false
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
export type RPCInvoke = <Name extends keyof FlattenedRPCMap>(
|
|
71
|
+
...args: IsVoidishInput<FlattenedRPCMap[Name]['input']> extends true
|
|
72
|
+
? [name: Name]
|
|
73
|
+
: [name: Name, data: FlattenedRPCMap[Name]['input']]
|
|
74
|
+
) => Promise<FlattenedRPCMap[Name]['output']>
|
|
75
|
+
|
|
76
|
+
export type RPCRemote = <Name extends keyof FlattenedRPCMap>(
|
|
77
|
+
...args: IsVoidishInput<FlattenedRPCMap[Name]['input']> extends true
|
|
78
|
+
? [name: Name]
|
|
79
|
+
: [name: Name, data: FlattenedRPCMap[Name]['input']]
|
|
80
|
+
) => Promise<FlattenedRPCMap[Name]['output']>
|
|
81
|
+
|
|
82
|
+
import type { FlattenedWorkflowMap } from '../workflow/pikku-workflow-map.gen.d.js'
|
|
83
|
+
|
|
84
|
+
import type { AgentMap } from '../agent/pikku-agent-map.gen.d.js'
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
type FlattenedAgentMap = AgentMap
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
import type { PikkuRPC } from '@pikku/core/rpc'
|
|
91
|
+
|
|
92
|
+
interface AIAgentInput {
|
|
93
|
+
message: string
|
|
94
|
+
threadId: string
|
|
95
|
+
resourceId: string
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type TypedStartWorkflow = <Name extends keyof FlattenedWorkflowMap>(
|
|
99
|
+
name: Name,
|
|
100
|
+
input: FlattenedWorkflowMap[Name]['input'],
|
|
101
|
+
options?: { startNode?: string }
|
|
102
|
+
) => Promise<{ runId: string }>
|
|
103
|
+
|
|
104
|
+
export type TypedRunWorkflow = <Name extends keyof FlattenedWorkflowMap>(
|
|
105
|
+
name: Name,
|
|
106
|
+
input: FlattenedWorkflowMap[Name]['input']
|
|
107
|
+
) => Promise<FlattenedWorkflowMap[Name]['output']>
|
|
108
|
+
|
|
109
|
+
export type TypedWorkflowStatus = (
|
|
110
|
+
workflowName: string,
|
|
111
|
+
runId: string
|
|
112
|
+
) => Promise<{ id: string; status: 'running' | 'suspended' | 'completed' | 'failed' | 'cancelled'; output?: unknown; error?: { message?: string } }>
|
|
113
|
+
|
|
114
|
+
type TypedAgentRun = [keyof FlattenedAgentMap] extends [never]
|
|
115
|
+
? (name: string, input: AIAgentInput) => Promise<any>
|
|
116
|
+
: <Name extends keyof FlattenedAgentMap>(
|
|
117
|
+
name: Name,
|
|
118
|
+
input: AIAgentInput
|
|
119
|
+
) => Promise<{ runId: string; result: FlattenedAgentMap[Name]['output']; usage: { inputTokens: number; outputTokens: number } }>
|
|
120
|
+
|
|
121
|
+
type TypedAgentStream = [keyof FlattenedAgentMap] extends [never]
|
|
122
|
+
? (name: string, input: AIAgentInput, options?: { requiresToolApproval?: 'all' | 'explicit' | false }) => Promise<void>
|
|
123
|
+
: <Name extends keyof FlattenedAgentMap>(
|
|
124
|
+
name: Name,
|
|
125
|
+
input: AIAgentInput,
|
|
126
|
+
options?: { requiresToolApproval?: 'all' | 'explicit' | false }
|
|
127
|
+
) => Promise<void>
|
|
128
|
+
|
|
129
|
+
export type TypedPikkuRPC = PikkuRPC<RPCInvoke, RPCRemote, TypedStartWorkflow, TypedAgentRun, TypedAgentStream>
|
|
130
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
import { pikkuState } from '@pikku/core/internal'
|
|
5
|
+
import metaData from './pikku-rpc-wirings-meta.internal.gen.json' with { type: 'json' }
|
|
6
|
+
pikkuState('@pikku/addon-execution', 'rpc', 'meta', metaData as Record<string, string>)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Scheduler-specific type definitions for tree-shaking optimization
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { CoreScheduledTask, wireScheduler as wireSchedulerCore } from '@pikku/core/scheduler'
|
|
9
|
+
import type { PikkuFunctionConfig, PikkuMiddleware } from '../function/pikku-function-types.gen.js'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Type definition for scheduled tasks that run at specified intervals.
|
|
13
|
+
* These are sessionless functions that execute based on cron expressions.
|
|
14
|
+
*/
|
|
15
|
+
type SchedulerWiring = CoreScheduledTask<PikkuFunctionConfig<void, void, 'session' | 'rpc'>, PikkuMiddleware>
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Registers a scheduled task with the Pikku framework.
|
|
19
|
+
* Tasks run based on cron expressions and are sessionless.
|
|
20
|
+
*
|
|
21
|
+
* @param task - Scheduled task definition with cron expression and handler
|
|
22
|
+
*/
|
|
23
|
+
export const wireScheduler = (task: SchedulerWiring) => {
|
|
24
|
+
wireSchedulerCore(task as any)
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
import { addSchema } from '@pikku/core/schema'
|
|
5
|
+
|
|
6
|
+
import * as ExecuteInput from './schemas/ExecuteInput.schema.json' with { type: 'json' }
|
|
7
|
+
addSchema('ExecuteInput', ExecuteInput, '@pikku/addon-execution')
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
import * as ExecuteOutput from './schemas/ExecuteOutput.schema.json' with { type: 'json' }
|
|
11
|
+
addSchema('ExecuteOutput', ExecuteOutput, '@pikku/addon-execution')
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import * as SpawnCommandInput from './schemas/SpawnCommandInput.schema.json' with { type: 'json' }
|
|
15
|
+
addSchema('SpawnCommandInput', SpawnCommandInput, '@pikku/addon-execution')
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import * as SpawnCommandOutput from './schemas/SpawnCommandOutput.schema.json' with { type: 'json' }
|
|
19
|
+
addSchema('SpawnCommandOutput', SpawnCommandOutput, '@pikku/addon-execution')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"command":{"type":"string","description":"The shell command to run"},"cwd":{"description":"Working directory for the command","type":"string"},"timeout":{"description":"Kill the command if it runs longer than this many milliseconds","type":"number"}},"required":["command"],"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"stdout":{"type":"string","description":"Standard output"},"stderr":{"type":"string","description":"Standard error"},"exitCode":{"type":"number","description":"Process exit code (0 on success)"}},"required":["stdout","stderr","exitCode"],"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"command":{"type":"string","description":"The program to run (no shell interpretation)"},"args":{"description":"Arguments passed to the program","type":"array","items":{"type":"string"}},"cwd":{"description":"Working directory for the process","type":"string"},"timeout":{"description":"Kill the process if it runs longer than this many milliseconds","type":"number"}},"required":["command"],"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"stdout":{"type":"string","description":"Standard output"},"stderr":{"type":"string","description":"Standard error"},"exitCode":{"type":"number","description":"Process exit code (0 on success)"}},"required":["stdout","stderr","exitCode"],"additionalProperties":false}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
import { TypedSecretService as CoreTypedSecretService, type CredentialMeta } from '@pikku/core/services'
|
|
5
|
+
import type { SecretService } from '@pikku/core/services'
|
|
6
|
+
|
|
7
|
+
export interface CredentialsMap {
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type SecretId = keyof CredentialsMap
|
|
12
|
+
|
|
13
|
+
const CREDENTIALS_META: Record<string, CredentialMeta> = {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class TypedSecretService extends CoreTypedSecretService<CredentialsMap> {
|
|
18
|
+
constructor(secrets: SecretService) {
|
|
19
|
+
super(secrets, CREDENTIALS_META)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Trigger-specific type definitions for tree-shaking optimization
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { CorePikkuTriggerFunction, CorePikkuTriggerFunctionConfig, CoreTrigger, wireTrigger as wireTriggerCore, wireTriggerSource as wireTriggerSourceCore } from '@pikku/core/trigger'
|
|
9
|
+
import type { CoreNodeConfig } from '@pikku/core/node'
|
|
10
|
+
import type { SingletonServices } from '../../types/application-types.d.js'
|
|
11
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A trigger function that sets up a subscription and returns a teardown function.
|
|
17
|
+
* The trigger is fired via wire.trigger.invoke(data).
|
|
18
|
+
*
|
|
19
|
+
* @template TInput - Input type (configuration passed when wired)
|
|
20
|
+
* @template TOutput - Output type produced when trigger fires
|
|
21
|
+
*/
|
|
22
|
+
export type PikkuTriggerFunction<
|
|
23
|
+
TInput = unknown,
|
|
24
|
+
TOutput = unknown
|
|
25
|
+
> = CorePikkuTriggerFunction<TInput, TOutput, SingletonServices>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Configuration object for creating a trigger function with metadata
|
|
29
|
+
*/
|
|
30
|
+
export type PikkuTriggerFunctionConfig<
|
|
31
|
+
TInput = unknown,
|
|
32
|
+
TOutput = unknown,
|
|
33
|
+
InputSchema extends StandardSchemaV1 | undefined = undefined,
|
|
34
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
35
|
+
> = CorePikkuTriggerFunctionConfig<TInput, TOutput, SingletonServices, InputSchema, OutputSchema>
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Helper type to infer the output type from a Standard Schema
|
|
39
|
+
*/
|
|
40
|
+
type InferSchemaOutput<T> = T extends StandardSchemaV1<any, infer Output> ? Output : never
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Configuration object for trigger functions with Zod schema validation.
|
|
44
|
+
* Use this when you want to define input/output schemas using Zod.
|
|
45
|
+
* Types are automatically inferred from the schemas.
|
|
46
|
+
*/
|
|
47
|
+
export type PikkuTriggerFunctionConfigWithSchema<
|
|
48
|
+
InputSchema extends StandardSchemaV1,
|
|
49
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
50
|
+
> = {
|
|
51
|
+
title?: string
|
|
52
|
+
description?: string
|
|
53
|
+
tags?: string[]
|
|
54
|
+
func: PikkuTriggerFunction<
|
|
55
|
+
InferSchemaOutput<InputSchema>,
|
|
56
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown
|
|
57
|
+
>
|
|
58
|
+
input: InputSchema
|
|
59
|
+
output?: OutputSchema
|
|
60
|
+
node?: CoreNodeConfig
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Type definition for trigger wirings.
|
|
65
|
+
* Declares a trigger name and its target pikku function.
|
|
66
|
+
*/
|
|
67
|
+
export type TriggerWiring = CoreTrigger
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* A trigger source with the subscription function, using project-specific services.
|
|
71
|
+
*
|
|
72
|
+
* @template TInput - Input type passed to the trigger function
|
|
73
|
+
* @template TOutput - Output type produced when trigger fires
|
|
74
|
+
*/
|
|
75
|
+
export type TriggerSource<
|
|
76
|
+
TInput = unknown,
|
|
77
|
+
TOutput = unknown
|
|
78
|
+
> = {
|
|
79
|
+
name: string
|
|
80
|
+
func: PikkuTriggerFunctionConfig<TInput, TOutput>
|
|
81
|
+
} & (unknown extends TInput ? { input?: TInput } : { input: TInput })
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Creates a trigger function configuration.
|
|
85
|
+
* Use this to define trigger functions that set up subscriptions.
|
|
86
|
+
*
|
|
87
|
+
* @param triggerOrConfig - Function definition or configuration object
|
|
88
|
+
* @returns The normalized configuration object
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* export const redisSubscribeTrigger = pikkuTriggerFunc<
|
|
93
|
+
* { channel: string },
|
|
94
|
+
* { message: string }
|
|
95
|
+
* >(async ({ redis }, { channel }, { trigger }) => {
|
|
96
|
+
* const subscriber = redis.duplicate()
|
|
97
|
+
* await subscriber.subscribe(channel, (msg) => {
|
|
98
|
+
* trigger.invoke({ message: msg })
|
|
99
|
+
* })
|
|
100
|
+
* return () => subscriber.unsubscribe()
|
|
101
|
+
* })
|
|
102
|
+
*
|
|
103
|
+
* export const redisSubscribeTrigger = pikkuTriggerFunc({
|
|
104
|
+
* title: 'Redis Subscribe Trigger',
|
|
105
|
+
* description: 'Listens to Redis pub/sub channel',
|
|
106
|
+
* input: z.object({ channel: z.string() }),
|
|
107
|
+
* output: z.object({ message: z.string() }),
|
|
108
|
+
* func: async ({ redis }, { channel }, { trigger }) => {
|
|
109
|
+
* const subscriber = redis.duplicate()
|
|
110
|
+
* await subscriber.subscribe(channel, (msg) => {
|
|
111
|
+
* trigger.invoke({ message: msg })
|
|
112
|
+
* })
|
|
113
|
+
* return () => subscriber.unsubscribe()
|
|
114
|
+
* }
|
|
115
|
+
* })
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
export function pikkuTriggerFunc<
|
|
119
|
+
InputSchema extends StandardSchemaV1,
|
|
120
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
121
|
+
>(
|
|
122
|
+
config: PikkuTriggerFunctionConfigWithSchema<InputSchema, OutputSchema>
|
|
123
|
+
): PikkuTriggerFunctionConfig<InferSchemaOutput<InputSchema>, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, InputSchema, OutputSchema>
|
|
124
|
+
export function pikkuTriggerFunc<TInput, TOutput = unknown>(
|
|
125
|
+
triggerOrConfig:
|
|
126
|
+
| PikkuTriggerFunction<TInput, TOutput>
|
|
127
|
+
| PikkuTriggerFunctionConfig<TInput, TOutput>
|
|
128
|
+
): PikkuTriggerFunctionConfig<TInput, TOutput>
|
|
129
|
+
export function pikkuTriggerFunc(triggerOrConfig: any) {
|
|
130
|
+
if (typeof triggerOrConfig === 'function') {
|
|
131
|
+
return { func: triggerOrConfig }
|
|
132
|
+
}
|
|
133
|
+
return triggerOrConfig
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Registers a trigger with the Pikku framework.
|
|
138
|
+
* Declares a trigger name and its target pikku function.
|
|
139
|
+
* Runs everywhere — inspector extracts at build time.
|
|
140
|
+
*
|
|
141
|
+
* @param trigger - Trigger definition with name and function config
|
|
142
|
+
*/
|
|
143
|
+
export const wireTrigger = (
|
|
144
|
+
trigger: TriggerWiring
|
|
145
|
+
) => {
|
|
146
|
+
wireTriggerCore(trigger as any)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Registers a trigger source with the Pikku framework.
|
|
151
|
+
* Provides the subscription function and input data.
|
|
152
|
+
* Only imported in the trigger worker process.
|
|
153
|
+
*
|
|
154
|
+
* @param source - Trigger source with name, func, and input
|
|
155
|
+
*/
|
|
156
|
+
export const wireTriggerSource = <TInput = unknown, TOutput = unknown>(
|
|
157
|
+
source: TriggerSource<TInput, TOutput>
|
|
158
|
+
) => {
|
|
159
|
+
wireTriggerSourceCore(source as any)
|
|
160
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
import { TypedVariablesService as CoreTypedVariablesService, type VariableMeta } from '@pikku/core/services'
|
|
5
|
+
import type { VariablesService } from '@pikku/core/services'
|
|
6
|
+
|
|
7
|
+
export interface VariablesMap {
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type VariableId = keyof VariablesMap
|
|
12
|
+
|
|
13
|
+
const VARIABLES_META: Record<string, VariableMeta> = {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class TypedVariablesService extends CoreTypedVariablesService<VariablesMap> {
|
|
18
|
+
constructor(variables: VariablesService) {
|
|
19
|
+
super(variables, VARIABLES_META)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.55
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Workflow type map with input/output types for each workflow
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
interface WorkflowHandler<I, O> {
|
|
13
|
+
input: I;
|
|
14
|
+
output: O;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface GraphNodeHandler<I> {
|
|
18
|
+
input: I;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type WorkflowMap = {
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type GraphsMap = {
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type FlattenedWorkflowMap = WorkflowMap
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
export type WorkflowClient<Name extends keyof FlattenedWorkflowMap> = {
|
|
31
|
+
start: (input: FlattenedWorkflowMap[Name]['input']) => Promise<{ runId: string }>;
|
|
32
|
+
getRun: <output extends keyof FlattenedWorkflowMap[Name]>(runId: string) => Promise<FlattenedWorkflowMap[Name][output]>;
|
|
33
|
+
cancelRun: (runId: string) => Promise<boolean>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type TypedWorkflowClients = {
|
|
37
|
+
[Name in keyof FlattenedWorkflowMap]: WorkflowClient<Name>;
|
|
38
|
+
}
|