@pikku/core 0.12.0 → 0.12.1
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/CHANGELOG.md +24 -0
- package/dist/errors/errors.d.ts +6 -0
- package/dist/errors/errors.js +10 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/function/function-runner.d.ts +3 -3
- package/dist/function/function-runner.js +66 -44
- package/dist/function/functions.types.d.ts +1 -0
- package/dist/handle-error.d.ts +2 -2
- package/dist/handle-error.js +2 -2
- package/dist/index.d.ts +5 -3
- package/dist/index.js +2 -1
- package/dist/internal.d.ts +3 -0
- package/dist/internal.js +2 -0
- package/dist/middleware/auth-bearer.d.ts +1 -1
- package/dist/middleware/auth-bearer.js +1 -1
- package/dist/middleware/auth-cookie.d.ts +2 -2
- package/dist/middleware/auth-cookie.js +1 -1
- package/dist/middleware/cors.d.ts +2 -2
- package/dist/middleware/cors.js +45 -37
- package/dist/middleware-runner.d.ts +1 -1
- package/dist/permissions.d.ts +2 -2
- package/dist/pikku-state.d.ts +9 -8
- package/dist/pikku-state.js +30 -17
- package/dist/schema.d.ts +4 -4
- package/dist/schema.js +9 -5
- package/dist/services/ai-agent-runner-service.d.ts +22 -3
- package/dist/services/ai-run-state-service.d.ts +1 -1
- package/dist/services/ai-storage-service.d.ts +1 -1
- package/dist/services/content-service.d.ts +6 -0
- package/dist/services/gopass-secrets.d.ts +1 -1
- package/dist/services/gopass-secrets.js +3 -0
- package/dist/services/in-memory-ai-run-state-service.d.ts +15 -0
- package/dist/services/in-memory-ai-run-state-service.js +44 -0
- package/dist/services/in-memory-trigger-service.d.ts +0 -1
- package/dist/services/in-memory-trigger-service.js +6 -8
- package/dist/services/index.d.ts +3 -2
- package/dist/services/index.js +1 -0
- package/dist/services/local-content.d.ts +2 -1
- package/dist/services/local-content.js +6 -1
- package/dist/services/local-secrets.d.ts +2 -2
- package/dist/services/local-variables.d.ts +1 -1
- package/dist/services/logger-console.d.ts +2 -1
- package/dist/services/scheduler-service.d.ts +0 -12
- package/dist/services/scheduler-service.js +0 -6
- package/dist/services/scoped-secret-service.d.ts +1 -1
- package/dist/services/trigger-service.d.ts +0 -7
- package/dist/services/user-session-service.d.ts +3 -3
- package/dist/services/workflow-service.d.ts +2 -3
- package/dist/types/core.types.d.ts +24 -18
- package/dist/types/state.types.d.ts +17 -15
- package/dist/utils.d.ts +5 -5
- package/dist/utils.js +12 -9
- package/dist/wirings/ai-agent/ai-agent-assistant-ui.d.ts +5 -0
- package/dist/wirings/ai-agent/ai-agent-assistant-ui.js +146 -0
- package/dist/wirings/ai-agent/ai-agent-helpers.d.ts +28 -0
- package/dist/wirings/ai-agent/ai-agent-helpers.js +40 -0
- package/dist/wirings/ai-agent/ai-agent-prepare.d.ts +4 -5
- package/dist/wirings/ai-agent/ai-agent-prepare.js +66 -30
- package/dist/wirings/ai-agent/ai-agent-registry.d.ts +1 -1
- package/dist/wirings/ai-agent/ai-agent-runner.js +107 -8
- package/dist/wirings/ai-agent/ai-agent-stream.d.ts +2 -1
- package/dist/wirings/ai-agent/ai-agent-stream.js +246 -87
- package/dist/wirings/ai-agent/ai-agent.types.d.ts +61 -2
- package/dist/wirings/ai-agent/index.d.ts +3 -1
- package/dist/wirings/ai-agent/index.js +2 -0
- package/dist/wirings/channel/channel-common.d.ts +2 -2
- package/dist/wirings/channel/channel-handler.d.ts +3 -3
- package/dist/wirings/channel/channel-handler.js +4 -4
- package/dist/wirings/channel/channel-runner.d.ts +5 -5
- package/dist/wirings/channel/channel-runner.js +3 -2
- package/dist/wirings/channel/channel-store.d.ts +1 -1
- package/dist/wirings/channel/channel.types.d.ts +4 -6
- package/dist/wirings/channel/local/local-channel-runner.d.ts +7 -2
- package/dist/wirings/channel/local/local-channel-runner.js +4 -3
- package/dist/wirings/channel/local/local-eventhub-service.d.ts +2 -2
- package/dist/wirings/channel/log-channels.d.ts +1 -1
- package/dist/wirings/channel/pikku-abstract-channel-handler.d.ts +1 -1
- package/dist/wirings/channel/serverless/serverless-channel-runner.d.ts +4 -4
- package/dist/wirings/channel/serverless/serverless-channel-runner.js +25 -19
- package/dist/wirings/cli/channel/cli-channel-runner.d.ts +1 -1
- package/dist/wirings/cli/cli-runner.d.ts +2 -2
- package/dist/wirings/cli/cli.types.d.ts +3 -3
- package/dist/wirings/cli/command-parser.d.ts +1 -1
- package/dist/wirings/http/http-runner.d.ts +9 -9
- package/dist/wirings/http/http-runner.js +33 -14
- package/dist/wirings/http/http.types.d.ts +2 -6
- package/dist/wirings/http/log-http-routes.d.ts +1 -1
- package/dist/wirings/http/pikku-fetch-http-request.d.ts +1 -1
- package/dist/wirings/http/pikku-fetch-http-response.d.ts +2 -2
- package/dist/wirings/http/pikku-fetch-http-response.js +6 -1
- package/dist/wirings/http/routers/http-router.d.ts +1 -1
- package/dist/wirings/http/routers/path-to-regex.d.ts +2 -2
- package/dist/wirings/mcp/mcp-endpoint-registry.d.ts +1 -1
- package/dist/wirings/mcp/mcp-runner.d.ts +0 -3
- package/dist/wirings/mcp/mcp-runner.js +4 -2
- package/dist/wirings/mcp/mcp.types.d.ts +2 -2
- package/dist/wirings/oauth2/oauth2-client.d.ts +3 -3
- package/dist/wirings/oauth2/wire-oauth2-credential.d.ts +1 -1
- package/dist/wirings/queue/index.d.ts +1 -1
- package/dist/wirings/queue/index.js +1 -1
- package/dist/wirings/queue/queue-runner.d.ts +1 -12
- package/dist/wirings/queue/queue-runner.js +4 -12
- package/dist/wirings/queue/queue.types.d.ts +3 -9
- package/dist/wirings/queue/register-queue-helper.d.ts +2 -2
- package/dist/wirings/queue/register-queue-helper.js +1 -1
- package/dist/wirings/queue/validate-worker-config.d.ts +1 -1
- package/dist/wirings/rpc/index.d.ts +2 -0
- package/dist/wirings/rpc/index.js +1 -0
- package/dist/wirings/rpc/rpc-runner.d.ts +36 -14
- package/dist/wirings/rpc/rpc-runner.js +56 -28
- package/dist/wirings/rpc/rpc-types.d.ts +14 -2
- package/dist/wirings/rpc/wire-addon.d.ts +10 -0
- package/dist/wirings/rpc/wire-addon.js +9 -0
- package/dist/wirings/scheduler/index.d.ts +1 -1
- package/dist/wirings/scheduler/index.js +1 -1
- package/dist/wirings/scheduler/log-schedulers.d.ts +1 -1
- package/dist/wirings/scheduler/scheduler-runner.d.ts +3 -10
- package/dist/wirings/scheduler/scheduler-runner.js +4 -25
- package/dist/wirings/scheduler/scheduler.types.d.ts +2 -2
- package/dist/wirings/trigger/pikku-trigger-service.d.ts +2 -6
- package/dist/wirings/trigger/pikku-trigger-service.js +11 -16
- package/dist/wirings/trigger/trigger-runner.d.ts +1 -5
- package/dist/wirings/trigger/trigger-runner.js +4 -3
- package/dist/wirings/workflow/pikku-workflow-service.d.ts +2 -6
- package/dist/wirings/workflow/pikku-workflow-service.js +20 -29
- package/dist/wirings/workflow/workflow.types.d.ts +2 -2
- package/package.json +2 -1
- package/src/crypto-utils.test.ts +116 -0
- package/src/errors/error.test.ts +143 -2
- package/src/errors/errors.ts +10 -0
- package/src/errors/index.ts +1 -0
- package/src/function/function-runner.test.ts +2 -2
- package/src/function/function-runner.ts +72 -49
- package/src/function/functions.types.ts +1 -0
- package/src/handle-error.test.ts +361 -0
- package/src/handle-error.ts +4 -4
- package/src/index.ts +3 -10
- package/src/internal.ts +6 -0
- package/src/middleware/auth-apikey.test.ts +1 -1
- package/src/middleware/auth-bearer.test.ts +1 -1
- package/src/middleware/auth-bearer.ts +2 -5
- package/src/middleware/auth-cookie.test.ts +1 -1
- package/src/middleware/auth-cookie.ts +3 -5
- package/src/middleware/cors.test.ts +424 -0
- package/src/middleware/cors.ts +14 -6
- package/src/middleware/remote-auth.test.ts +488 -0
- package/src/middleware-runner.test.ts +1 -1
- package/src/middleware-runner.ts +1 -1
- package/src/permissions.test.ts +2 -2
- package/src/permissions.ts +2 -2
- package/src/pikku-state.test.ts +224 -0
- package/src/pikku-state.ts +40 -28
- package/src/schema.test.ts +198 -6
- package/src/schema.ts +11 -7
- package/src/services/ai-agent-runner-service.ts +15 -3
- package/src/services/ai-run-state-service.ts +1 -1
- package/src/services/ai-storage-service.ts +1 -1
- package/src/services/content-service.ts +7 -0
- package/src/services/gopass-secrets.ts +4 -1
- package/src/services/in-memory-ai-run-state-service.ts +73 -0
- package/src/services/in-memory-trigger-service.ts +6 -10
- package/src/services/in-memory-workflow-service.test.ts +351 -0
- package/src/services/index.ts +2 -1
- package/src/services/local-content.ts +9 -3
- package/src/services/local-secrets.test.ts +80 -0
- package/src/services/local-secrets.ts +2 -2
- package/src/services/local-variables.test.ts +61 -0
- package/src/services/local-variables.ts +1 -1
- package/src/services/logger-console.test.ts +118 -0
- package/src/services/logger-console.ts +2 -1
- package/src/services/scheduler-service.ts +0 -18
- package/src/services/scoped-secret-service.test.ts +74 -0
- package/src/services/scoped-secret-service.ts +1 -1
- package/src/services/trigger-service.ts +0 -21
- package/src/services/typed-secret-service.test.ts +93 -0
- package/src/services/typed-variables-service.test.ts +73 -0
- package/src/services/user-session-service.test.ts +113 -0
- package/src/services/user-session-service.ts +3 -3
- package/src/services/workflow-service.ts +2 -12
- package/src/time-utils.test.ts +1 -1
- package/src/types/core.types.ts +25 -19
- package/src/types/state.types.ts +24 -15
- package/src/utils.test.ts +350 -0
- package/src/utils.ts +14 -13
- package/src/wirings/ai-agent/ai-agent-assistant-ui.test.ts +363 -0
- package/src/wirings/ai-agent/ai-agent-assistant-ui.ts +214 -0
- package/src/wirings/ai-agent/ai-agent-helpers.test.ts +152 -0
- package/src/wirings/ai-agent/ai-agent-helpers.ts +76 -0
- package/src/wirings/ai-agent/ai-agent-model-config.test.ts +115 -0
- package/src/wirings/ai-agent/ai-agent-prepare.ts +79 -45
- package/src/wirings/ai-agent/ai-agent-registry.ts +1 -1
- package/src/wirings/ai-agent/ai-agent-runner.test.ts +245 -3
- package/src/wirings/ai-agent/ai-agent-runner.ts +121 -7
- package/src/wirings/ai-agent/ai-agent-stream.test.ts +430 -24
- package/src/wirings/ai-agent/ai-agent-stream.ts +377 -102
- package/src/wirings/ai-agent/ai-agent.types.ts +57 -2
- package/src/wirings/ai-agent/index.ts +11 -0
- package/src/wirings/channel/channel-common.ts +2 -2
- package/src/wirings/channel/channel-handler.ts +13 -9
- package/src/wirings/channel/channel-runner.ts +6 -6
- package/src/wirings/channel/channel-store.ts +1 -1
- package/src/wirings/channel/channel.types.ts +4 -8
- package/src/wirings/channel/local/local-channel-runner.test.ts +19 -12
- package/src/wirings/channel/local/local-channel-runner.ts +18 -13
- package/src/wirings/channel/local/local-eventhub-service.test.ts +2 -2
- package/src/wirings/channel/local/local-eventhub-service.ts +2 -2
- package/src/wirings/channel/log-channels.ts +1 -1
- package/src/wirings/channel/pikku-abstract-channel-handler.ts +1 -1
- package/src/wirings/channel/serverless/serverless-channel-runner.ts +37 -32
- package/src/wirings/cli/channel/cli-channel-runner.ts +1 -1
- package/src/wirings/cli/cli-runner.test.ts +1 -1
- package/src/wirings/cli/cli-runner.ts +11 -4
- package/src/wirings/cli/cli.types.ts +3 -3
- package/src/wirings/cli/command-parser.test.ts +1 -1
- package/src/wirings/cli/command-parser.ts +1 -1
- package/src/wirings/http/http-routes.test.ts +1 -1
- package/src/wirings/http/http-runner.test.ts +9 -17
- package/src/wirings/http/http-runner.ts +43 -27
- package/src/wirings/http/http.types.ts +1 -14
- package/src/wirings/http/log-http-routes.ts +1 -1
- package/src/wirings/http/pikku-fetch-http-request.ts +1 -1
- package/src/wirings/http/pikku-fetch-http-response.ts +12 -5
- package/src/wirings/http/routers/http-router.ts +1 -1
- package/src/wirings/http/routers/path-to-regex.test.ts +1 -1
- package/src/wirings/http/routers/path-to-regex.ts +4 -3
- package/src/wirings/mcp/mcp-endpoint-registry.ts +5 -1
- package/src/wirings/mcp/mcp-runner.ts +9 -15
- package/src/wirings/mcp/mcp.types.ts +2 -2
- package/src/wirings/oauth2/oauth2-client.ts +3 -3
- package/src/wirings/oauth2/wire-oauth2-credential.ts +1 -1
- package/src/wirings/queue/index.ts +0 -1
- package/src/wirings/queue/queue-runner.test.ts +52 -25
- package/src/wirings/queue/queue-runner.ts +8 -30
- package/src/wirings/queue/queue.types.ts +3 -13
- package/src/wirings/queue/register-queue-helper.ts +3 -5
- package/src/wirings/queue/validate-worker-config.test.ts +108 -0
- package/src/wirings/queue/validate-worker-config.ts +4 -1
- package/src/wirings/rpc/index.ts +2 -0
- package/src/wirings/rpc/rpc-runner.ts +92 -49
- package/src/wirings/rpc/rpc-types.ts +17 -2
- package/src/wirings/rpc/wire-addon.ts +20 -0
- package/src/wirings/scheduler/index.ts +0 -1
- package/src/wirings/scheduler/log-schedulers.ts +1 -1
- package/src/wirings/scheduler/scheduler-runner.test.ts +49 -60
- package/src/wirings/scheduler/scheduler-runner.ts +9 -56
- package/src/wirings/scheduler/scheduler.types.ts +2 -2
- package/src/wirings/secret/validate-secret-definitions.test.ts +140 -0
- package/src/wirings/trigger/pikku-trigger-service.ts +17 -39
- package/src/wirings/trigger/trigger-runner.test.ts +79 -0
- package/src/wirings/trigger/trigger-runner.ts +8 -11
- package/src/wirings/variable/validate-variable-definitions.test.ts +91 -0
- package/src/wirings/workflow/graph/graph-runner.test.ts +14 -22
- package/src/wirings/workflow/graph/template.test.ts +49 -0
- package/src/wirings/workflow/pikku-workflow-service.test.ts +15 -27
- package/src/wirings/workflow/pikku-workflow-service.ts +29 -45
- package/src/wirings/workflow/workflow-helpers.test.ts +129 -0
- package/src/wirings/workflow/workflow.types.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/wirings/workflow/workflow-utils.d.ts +0 -1
- package/dist/wirings/workflow/workflow-utils.js +0 -1
- package/src/wirings/workflow/workflow-utils.ts +0 -0
package/dist/pikku-state.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
const PIKKU_STATE_KEY = Symbol.for('@pikku/core/state');
|
|
2
|
+
export const getAllPackageStates = () => {
|
|
3
|
+
if (!globalThis[PIKKU_STATE_KEY]) {
|
|
4
|
+
;
|
|
5
|
+
globalThis[PIKKU_STATE_KEY] = new Map();
|
|
6
|
+
}
|
|
7
|
+
return globalThis[PIKKU_STATE_KEY];
|
|
8
|
+
};
|
|
1
9
|
/**
|
|
2
10
|
* Get or set package-scoped pikku state
|
|
3
11
|
*
|
|
4
|
-
* @param packageName - Package name (null for main package, '@scope/package' for
|
|
12
|
+
* @param packageName - Package name (null for main package, '@scope/package' for addon packages)
|
|
5
13
|
* @param type - State category (function, rpc, http, etc.)
|
|
6
14
|
* @param content - Content key within the category
|
|
7
15
|
* @param value - Optional value to set
|
|
@@ -11,17 +19,16 @@
|
|
|
11
19
|
* // Main package
|
|
12
20
|
* pikkuState(null, 'function', 'functions').get(funcName)
|
|
13
21
|
*
|
|
14
|
-
* //
|
|
22
|
+
* // Addon package
|
|
15
23
|
* pikkuState('@acme/stripe-functions', 'rpc', 'meta')
|
|
16
24
|
*/
|
|
17
25
|
export const pikkuState = (packageName, type, content, value) => {
|
|
18
26
|
const resolvedPackageName = packageName ?? '__main__';
|
|
19
27
|
// Initialize package state if it doesn't exist
|
|
20
|
-
if (!
|
|
21
|
-
!globalThis.pikkuState.has(resolvedPackageName)) {
|
|
28
|
+
if (!getAllPackageStates().has(resolvedPackageName)) {
|
|
22
29
|
initializePikkuState(resolvedPackageName);
|
|
23
30
|
}
|
|
24
|
-
const packageState =
|
|
31
|
+
const packageState = getAllPackageStates().get(resolvedPackageName);
|
|
25
32
|
if (value !== undefined) {
|
|
26
33
|
packageState[type][content] = value;
|
|
27
34
|
}
|
|
@@ -35,7 +42,7 @@ const createEmptyPackageState = () => ({
|
|
|
35
42
|
rpc: {
|
|
36
43
|
meta: {},
|
|
37
44
|
files: new Map(),
|
|
38
|
-
|
|
45
|
+
addons: new Map(),
|
|
39
46
|
},
|
|
40
47
|
http: {
|
|
41
48
|
middleware: new Map(),
|
|
@@ -120,35 +127,41 @@ const createEmptyPackageState = () => ({
|
|
|
120
127
|
* Initialize state for a new package
|
|
121
128
|
*/
|
|
122
129
|
export const initializePikkuState = (packageName) => {
|
|
123
|
-
if (!
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
if (!globalThis.pikkuState.has(packageName)) {
|
|
127
|
-
globalThis.pikkuState.set(packageName, createEmptyPackageState());
|
|
130
|
+
if (!getAllPackageStates().has(packageName)) {
|
|
131
|
+
getAllPackageStates().set(packageName, createEmptyPackageState());
|
|
128
132
|
}
|
|
129
133
|
};
|
|
130
134
|
export const resetPikkuState = () => {
|
|
131
135
|
// Preserve the errors map before resetting
|
|
132
|
-
const existingErrors =
|
|
133
|
-
globalThis
|
|
136
|
+
const existingErrors = getAllPackageStates().get('__main__')?.misc.errors;
|
|
137
|
+
globalThis[PIKKU_STATE_KEY] = new Map();
|
|
134
138
|
initializePikkuState('__main__');
|
|
135
139
|
// Restore the errors map if it existed
|
|
136
140
|
if (existingErrors) {
|
|
137
|
-
const mainState =
|
|
141
|
+
const mainState = getAllPackageStates().get('__main__');
|
|
138
142
|
mainState.misc.errors = existingErrors;
|
|
139
143
|
}
|
|
140
144
|
};
|
|
141
|
-
if (!
|
|
145
|
+
if (!getAllPackageStates().has('__main__')) {
|
|
142
146
|
resetPikkuState();
|
|
143
147
|
}
|
|
144
148
|
export const getPikkuMetaDir = (packageName) => {
|
|
145
149
|
return pikkuState(packageName ?? null, 'package', 'metaDir');
|
|
146
150
|
};
|
|
151
|
+
export const getSingletonServices = () => {
|
|
152
|
+
const services = pikkuState(null, 'package', 'singletonServices');
|
|
153
|
+
if (!services)
|
|
154
|
+
throw new Error('Singleton services not initialized');
|
|
155
|
+
return services;
|
|
156
|
+
};
|
|
157
|
+
export const getCreateWireServices = () => {
|
|
158
|
+
return pikkuState(null, 'package', 'factories')?.createWireServices;
|
|
159
|
+
};
|
|
147
160
|
/**
|
|
148
|
-
* Register service factories for an
|
|
161
|
+
* Register service factories for an addon package.
|
|
149
162
|
* These factories are used to create services when the package's functions are invoked.
|
|
150
163
|
*
|
|
151
|
-
* @param packageName - The package name (e.g., '@pikku/templates-function-
|
|
164
|
+
* @param packageName - The package name (e.g., '@pikku/templates-function-addon')
|
|
152
165
|
* @param factories - The service factory functions
|
|
153
166
|
*/
|
|
154
167
|
export const addPackageServiceFactories = (packageName, factories) => {
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Logger } from './services/logger.js';
|
|
2
|
-
import { SchemaService } from './services/schema-service.js';
|
|
1
|
+
import type { Logger } from './services/logger.js';
|
|
2
|
+
import type { SchemaService } from './services/schema-service.js';
|
|
3
3
|
/**
|
|
4
4
|
* Adds a schema to the schemas map for a specific package.
|
|
5
5
|
* @param name - The name of the schema.
|
|
6
6
|
* @param value - The schema value.
|
|
7
|
-
* @param packageName - The package name (null for main package, '@scope/package' for
|
|
7
|
+
* @param packageName - The package name (null for main package, '@scope/package' for addon packages).
|
|
8
8
|
* @ignore
|
|
9
9
|
*/
|
|
10
10
|
export declare const addSchema: (name: string, value: any, packageName?: string | null) => void;
|
|
11
11
|
/**
|
|
12
12
|
* Retrieves a schema from the schemas map for a specific package.
|
|
13
13
|
* @param name - The name of the schema.
|
|
14
|
-
* @param packageName - The package name (null for main package, '@scope/package' for
|
|
14
|
+
* @param packageName - The package name (null for main package, '@scope/package' for addon packages).
|
|
15
15
|
* @returns The schema value or undefined if not found.
|
|
16
16
|
* @ignore
|
|
17
17
|
*/
|
package/dist/schema.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { MissingSchemaError, UnprocessableContentError, } from './errors/errors.js';
|
|
2
|
-
import { pikkuState } from './pikku-state.js';
|
|
2
|
+
import { pikkuState, getAllPackageStates } from './pikku-state.js';
|
|
3
3
|
const schemaKey = (name, packageName) => packageName ? `${packageName}:${name}` : name;
|
|
4
4
|
/**
|
|
5
5
|
* Adds a schema to the schemas map for a specific package.
|
|
6
6
|
* @param name - The name of the schema.
|
|
7
7
|
* @param value - The schema value.
|
|
8
|
-
* @param packageName - The package name (null for main package, '@scope/package' for
|
|
8
|
+
* @param packageName - The package name (null for main package, '@scope/package' for addon packages).
|
|
9
9
|
* @ignore
|
|
10
10
|
*/
|
|
11
11
|
export const addSchema = (name, value, packageName = null) => {
|
|
12
|
-
|
|
12
|
+
const schema = value?.default ?? value;
|
|
13
|
+
pikkuState(packageName, 'misc', 'schemas').set(name, schema);
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* Retrieves a schema from the schemas map for a specific package.
|
|
16
17
|
* @param name - The name of the schema.
|
|
17
|
-
* @param packageName - The package name (null for main package, '@scope/package' for
|
|
18
|
+
* @param packageName - The package name (null for main package, '@scope/package' for addon packages).
|
|
18
19
|
* @returns The schema value or undefined if not found.
|
|
19
20
|
* @ignore
|
|
20
21
|
*/
|
|
@@ -26,10 +27,13 @@ export const getSchema = (name, packageName = null) => {
|
|
|
26
27
|
* @param logger - A logger for logging information.
|
|
27
28
|
*/
|
|
28
29
|
export const compileAllSchemas = (logger, schemaService) => {
|
|
30
|
+
if (!schemaService) {
|
|
31
|
+
schemaService = pikkuState(null, 'package', 'singletonServices')?.schema;
|
|
32
|
+
}
|
|
29
33
|
if (!schemaService) {
|
|
30
34
|
throw new Error('SchemaService needs to be defined to load schemas');
|
|
31
35
|
}
|
|
32
|
-
for (const [pkgName, packageState] of
|
|
36
|
+
for (const [pkgName, packageState] of getAllPackageStates()) {
|
|
33
37
|
const resolvedPkgName = pkgName === '__main__' ? null : pkgName;
|
|
34
38
|
for (const [name, schema] of packageState.misc.schemas) {
|
|
35
39
|
schemaService.compileSchema(schemaKey(name, resolvedPkgName), schema);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AIMessage, AIAgentStep, AIAgentToolDef, AIStreamChannel } from '../wirings/ai-agent/ai-agent.types.js';
|
|
1
|
+
import type { AIMessage, AIAgentStep, AIAgentToolDef, AIStreamChannel } from '../wirings/ai-agent/ai-agent.types.js';
|
|
2
2
|
export type AIAgentRunnerParams = {
|
|
3
3
|
model: string;
|
|
4
4
|
temperature?: number;
|
|
@@ -18,7 +18,26 @@ export type AIAgentRunnerResult = {
|
|
|
18
18
|
outputTokens: number;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
+
export type AIAgentStepResult = {
|
|
22
|
+
text: string;
|
|
23
|
+
object?: unknown;
|
|
24
|
+
toolCalls: {
|
|
25
|
+
toolCallId: string;
|
|
26
|
+
toolName: string;
|
|
27
|
+
args: unknown;
|
|
28
|
+
}[];
|
|
29
|
+
toolResults: {
|
|
30
|
+
toolCallId: string;
|
|
31
|
+
toolName: string;
|
|
32
|
+
result: unknown;
|
|
33
|
+
}[];
|
|
34
|
+
usage: {
|
|
35
|
+
inputTokens: number;
|
|
36
|
+
outputTokens: number;
|
|
37
|
+
};
|
|
38
|
+
finishReason: 'stop' | 'tool-calls' | 'length' | 'error' | 'unknown';
|
|
39
|
+
};
|
|
21
40
|
export interface AIAgentRunnerService {
|
|
22
|
-
stream(params: AIAgentRunnerParams, channel: AIStreamChannel): Promise<
|
|
23
|
-
run(params: AIAgentRunnerParams): Promise<
|
|
41
|
+
stream(params: AIAgentRunnerParams, channel: AIStreamChannel): Promise<AIAgentStepResult>;
|
|
42
|
+
run(params: AIAgentRunnerParams): Promise<AIAgentStepResult>;
|
|
24
43
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentRunState, PendingApproval } from '../wirings/ai-agent/ai-agent.types.js';
|
|
1
|
+
import type { AgentRunState, PendingApproval } from '../wirings/ai-agent/ai-agent.types.js';
|
|
2
2
|
export type CreateRunInput = Omit<AgentRunState, 'runId'>;
|
|
3
3
|
export interface AIRunStateService {
|
|
4
4
|
createRun(run: CreateRunInput): Promise<string>;
|
|
@@ -49,4 +49,10 @@ export interface ContentService {
|
|
|
49
49
|
* @returns A readable file stream.
|
|
50
50
|
*/
|
|
51
51
|
readFile(assetKey: string): Promise<ReadableStream | NodeJS.ReadableStream>;
|
|
52
|
+
/**
|
|
53
|
+
* Reads an entire file from storage into a Buffer.
|
|
54
|
+
* @param assetKey - The key of the file to read.
|
|
55
|
+
* @returns The file contents as a Buffer.
|
|
56
|
+
*/
|
|
57
|
+
readFileAsBuffer(assetKey: string): Promise<Buffer>;
|
|
52
58
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AIRunStateService, CreateRunInput } from './ai-run-state-service.js';
|
|
2
|
+
import type { AgentRunState, PendingApproval } from '../wirings/ai-agent/ai-agent.types.js';
|
|
3
|
+
export declare class InMemoryAIRunStateService implements AIRunStateService {
|
|
4
|
+
private runs;
|
|
5
|
+
private counter;
|
|
6
|
+
createRun(run: CreateRunInput): Promise<string>;
|
|
7
|
+
updateRun(runId: string, updates: Partial<AgentRunState>): Promise<void>;
|
|
8
|
+
getRun(runId: string): Promise<AgentRunState | null>;
|
|
9
|
+
getRunsByThread(threadId: string): Promise<AgentRunState[]>;
|
|
10
|
+
resolveApproval(toolCallId: string, status: 'approved' | 'denied'): Promise<void>;
|
|
11
|
+
findRunByToolCallId(toolCallId: string): Promise<{
|
|
12
|
+
run: AgentRunState;
|
|
13
|
+
approval: PendingApproval;
|
|
14
|
+
} | null>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export class InMemoryAIRunStateService {
|
|
2
|
+
runs = new Map();
|
|
3
|
+
counter = 0;
|
|
4
|
+
async createRun(run) {
|
|
5
|
+
const runId = `run-${++this.counter}-${Date.now()}`;
|
|
6
|
+
this.runs.set(runId, { ...run, runId });
|
|
7
|
+
return runId;
|
|
8
|
+
}
|
|
9
|
+
async updateRun(runId, updates) {
|
|
10
|
+
const run = this.runs.get(runId);
|
|
11
|
+
if (run) {
|
|
12
|
+
Object.assign(run, updates, { updatedAt: new Date() });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async getRun(runId) {
|
|
16
|
+
return this.runs.get(runId) ?? null;
|
|
17
|
+
}
|
|
18
|
+
async getRunsByThread(threadId) {
|
|
19
|
+
return [...this.runs.values()].filter((r) => r.threadId === threadId);
|
|
20
|
+
}
|
|
21
|
+
async resolveApproval(toolCallId, status) {
|
|
22
|
+
for (const run of this.runs.values()) {
|
|
23
|
+
if (run.pendingApprovals) {
|
|
24
|
+
const approval = run.pendingApprovals.find((a) => a.toolCallId === toolCallId);
|
|
25
|
+
if (approval) {
|
|
26
|
+
run.pendingApprovals = run.pendingApprovals.filter((a) => a.toolCallId !== toolCallId);
|
|
27
|
+
run.updatedAt = new Date();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async findRunByToolCallId(toolCallId) {
|
|
34
|
+
for (const run of this.runs.values()) {
|
|
35
|
+
if (run.pendingApprovals) {
|
|
36
|
+
const approval = run.pendingApprovals.find((a) => a.toolCallId === toolCallId);
|
|
37
|
+
if (approval) {
|
|
38
|
+
return { run, approval };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -11,7 +11,6 @@ import { PikkuTriggerService } from '../wirings/trigger/pikku-trigger-service.js
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
13
|
* const triggerService = new InMemoryTriggerService()
|
|
14
|
-
* triggerService.setServices(singletonServices, createWireServices)
|
|
15
14
|
* await triggerService.start()
|
|
16
15
|
*
|
|
17
16
|
* // On shutdown
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PikkuTriggerService } from '../wirings/trigger/pikku-trigger-service.js';
|
|
2
|
+
import { getSingletonServices } from '../pikku-state.js';
|
|
2
3
|
/**
|
|
3
4
|
* In-memory TriggerService implementation.
|
|
4
5
|
*
|
|
@@ -11,7 +12,6 @@ import { PikkuTriggerService } from '../wirings/trigger/pikku-trigger-service.js
|
|
|
11
12
|
* @example
|
|
12
13
|
* ```typescript
|
|
13
14
|
* const triggerService = new InMemoryTriggerService()
|
|
14
|
-
* triggerService.setServices(singletonServices, createWireServices)
|
|
15
15
|
* await triggerService.start()
|
|
16
16
|
*
|
|
17
17
|
* // On shutdown
|
|
@@ -20,9 +20,7 @@ import { PikkuTriggerService } from '../wirings/trigger/pikku-trigger-service.js
|
|
|
20
20
|
*/
|
|
21
21
|
export class InMemoryTriggerService extends PikkuTriggerService {
|
|
22
22
|
async start() {
|
|
23
|
-
|
|
24
|
-
throw new Error('InMemoryTriggerService requires singletonServices to start triggers');
|
|
25
|
-
}
|
|
23
|
+
const singletonServices = getSingletonServices();
|
|
26
24
|
const triggerTargets = this.getTriggerTargets();
|
|
27
25
|
const triggerSources = this.getTriggerSources();
|
|
28
26
|
for (const [name, source] of triggerSources) {
|
|
@@ -31,20 +29,20 @@ export class InMemoryTriggerService extends PikkuTriggerService {
|
|
|
31
29
|
}
|
|
32
30
|
const targets = triggerTargets.get(name);
|
|
33
31
|
if (!targets || targets.length === 0) {
|
|
34
|
-
|
|
32
|
+
singletonServices.logger.info(`Trigger source '${name}' has no targets, skipping`);
|
|
35
33
|
continue;
|
|
36
34
|
}
|
|
37
35
|
try {
|
|
38
36
|
const triggerInstance = await this.setupTriggerInstance(name, source.input, (data) => this.onTriggerFire(name, targets, data));
|
|
39
37
|
this.activeTriggers.set(name, triggerInstance);
|
|
40
|
-
|
|
38
|
+
singletonServices.logger.info(`Started trigger: ${name}`);
|
|
41
39
|
}
|
|
42
40
|
catch (error) {
|
|
43
|
-
|
|
41
|
+
singletonServices.logger.error(`Failed to start trigger ${name}: ${error}`);
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
if (this.activeTriggers.size === 0) {
|
|
47
|
-
|
|
45
|
+
singletonServices.logger.info('No triggers started (no matching sources and targets found)');
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { LocalVariablesService } from './local-variables.js';
|
|
|
11
11
|
export { ConsoleLogger } from './logger-console.js';
|
|
12
12
|
export { InMemoryWorkflowService } from './in-memory-workflow-service.js';
|
|
13
13
|
export { InMemoryTriggerService } from './in-memory-trigger-service.js';
|
|
14
|
+
export { InMemoryAIRunStateService } from './in-memory-ai-run-state-service.js';
|
|
14
15
|
export type { ContentService } from './content-service.js';
|
|
15
16
|
export type { JWTService } from './jwt-service.js';
|
|
16
17
|
export type { Logger } from './logger.js';
|
|
@@ -18,11 +19,11 @@ export type { SecretService } from './secret-service.js';
|
|
|
18
19
|
export type { VariablesService } from './variables-service.js';
|
|
19
20
|
export type { SchemaService } from './schema-service.js';
|
|
20
21
|
export type { SessionService } from './user-session-service.js';
|
|
21
|
-
export type { ScheduledTaskSummary, ScheduledTaskInfo,
|
|
22
|
+
export type { ScheduledTaskSummary, ScheduledTaskInfo, SchedulerService, } from './scheduler-service.js';
|
|
22
23
|
export type { TriggerService } from './trigger-service.js';
|
|
23
24
|
export type { DeploymentService, DeploymentConfig, DeploymentInfo, DeploymentServiceConfig, } from './deployment-service.js';
|
|
24
25
|
export type { AIStorageService } from './ai-storage-service.js';
|
|
25
|
-
export type { AIAgentRunnerParams, AIAgentRunnerResult, AIAgentRunnerService, } from './ai-agent-runner-service.js';
|
|
26
|
+
export type { AIAgentRunnerParams, AIAgentRunnerResult, AIAgentStepResult, AIAgentRunnerService, } from './ai-agent-runner-service.js';
|
|
26
27
|
export type { CreateRunInput, AIRunStateService, } from './ai-run-state-service.js';
|
|
27
28
|
export type { CredentialStatus, CredentialMeta, } from './typed-secret-service.js';
|
|
28
29
|
export type { VariableStatus, VariableMeta } from './typed-variables-service.js';
|
package/dist/services/index.js
CHANGED
|
@@ -11,3 +11,4 @@ export { LocalVariablesService } from './local-variables.js';
|
|
|
11
11
|
export { ConsoleLogger } from './logger-console.js';
|
|
12
12
|
export { InMemoryWorkflowService } from './in-memory-workflow-service.js';
|
|
13
13
|
export { InMemoryTriggerService } from './in-memory-trigger-service.js';
|
|
14
|
+
export { InMemoryAIRunStateService } from './in-memory-ai-run-state-service.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContentService, Logger } from '@pikku/core/services';
|
|
1
|
+
import type { ContentService, Logger } from '@pikku/core/services';
|
|
2
2
|
export interface LocalContentConfig {
|
|
3
3
|
localFileUploadPath: string;
|
|
4
4
|
uploadUrlPrefix: string;
|
|
@@ -20,6 +20,7 @@ export declare class LocalContent implements ContentService {
|
|
|
20
20
|
writeFile(assetKey: string, stream: ReadableStream | NodeJS.ReadableStream): Promise<boolean>;
|
|
21
21
|
copyFile(assetKey: string, fromAbsolutePath: string): Promise<boolean>;
|
|
22
22
|
readFile(assetKey: string): Promise<ReadableStream | NodeJS.ReadableStream>;
|
|
23
|
+
readFileAsBuffer(assetKey: string): Promise<Buffer>;
|
|
23
24
|
deleteFile(assetKey: string): Promise<boolean>;
|
|
24
25
|
private createDirectoryForFile;
|
|
25
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createReadStream, createWriteStream, promises } from 'fs';
|
|
2
|
-
import { mkdir } from 'fs/promises';
|
|
2
|
+
import { mkdir, readFile } from 'fs/promises';
|
|
3
3
|
import { pipeline } from 'stream/promises';
|
|
4
4
|
export class LocalContent {
|
|
5
5
|
config;
|
|
@@ -69,6 +69,11 @@ export class LocalContent {
|
|
|
69
69
|
throw e;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
+
async readFileAsBuffer(assetKey) {
|
|
73
|
+
const filePath = `${this.config.localFileUploadPath}/${assetKey}`;
|
|
74
|
+
this.logger.debug(`Reading file as buffer: ${assetKey}`);
|
|
75
|
+
return readFile(filePath);
|
|
76
|
+
}
|
|
72
77
|
async deleteFile(assetKey) {
|
|
73
78
|
this.logger.debug(`deleting key: ${assetKey}`);
|
|
74
79
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SecretService } from './secret-service.js';
|
|
2
|
-
import { VariablesService } from './variables-service.js';
|
|
1
|
+
import type { SecretService } from './secret-service.js';
|
|
2
|
+
import type { VariablesService } from './variables-service.js';
|
|
3
3
|
/**
|
|
4
4
|
* Service for retrieving secrets from environment variables.
|
|
5
5
|
* Supports storing secrets locally in memory for CLI operations.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VariablesService } from './variables-service.js';
|
|
1
|
+
import type { VariablesService } from './variables-service.js';
|
|
2
2
|
export declare class LocalVariablesService implements VariablesService {
|
|
3
3
|
private variables;
|
|
4
4
|
constructor(variables?: Record<string, string | undefined>);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { CoreUserSession } from '../types/core.types.js';
|
|
2
|
-
import type { Logger } from './logger.js';
|
|
3
2
|
/**
|
|
4
3
|
* Minimal metadata for listing scheduled tasks
|
|
5
4
|
*/
|
|
@@ -22,11 +21,6 @@ export interface ScheduledTaskInfo extends ScheduledTaskSummary {
|
|
|
22
21
|
/** Task status */
|
|
23
22
|
status?: 'scheduled' | 'active' | 'completed' | 'failed';
|
|
24
23
|
}
|
|
25
|
-
export interface SchedulerRuntimeHandlers {
|
|
26
|
-
logger: Logger;
|
|
27
|
-
invokeRPC: (rpcName: string, data?: any, session?: CoreUserSession) => Promise<void>;
|
|
28
|
-
runScheduledTask: (name: string) => Promise<void>;
|
|
29
|
-
}
|
|
30
24
|
/**
|
|
31
25
|
* Abstract scheduler service for persistent scheduled task management
|
|
32
26
|
* Implementations use queue backends (pg-boss, BullMQ) for distributed scheduling
|
|
@@ -66,12 +60,6 @@ export declare abstract class SchedulerService {
|
|
|
66
60
|
* Close any open connections
|
|
67
61
|
*/
|
|
68
62
|
abstract close(): Promise<void>;
|
|
69
|
-
/**
|
|
70
|
-
* Set services needed for processing recurring tasks.
|
|
71
|
-
* Called after construction since the scheduler is created before
|
|
72
|
-
* singletonServices are fully assembled.
|
|
73
|
-
*/
|
|
74
|
-
setServices(_handlers: SchedulerRuntimeHandlers): void;
|
|
75
63
|
/**
|
|
76
64
|
* Start recurring scheduled tasks
|
|
77
65
|
*/
|
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
* Implementations use queue backends (pg-boss, BullMQ) for distributed scheduling
|
|
4
4
|
*/
|
|
5
5
|
export class SchedulerService {
|
|
6
|
-
/**
|
|
7
|
-
* Set services needed for processing recurring tasks.
|
|
8
|
-
* Called after construction since the scheduler is created before
|
|
9
|
-
* singletonServices are fully assembled.
|
|
10
|
-
*/
|
|
11
|
-
setServices(_handlers) { }
|
|
12
6
|
/**
|
|
13
7
|
* Start recurring scheduled tasks
|
|
14
8
|
*/
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CoreSingletonServices, CreateWireServices, CoreServices, CoreUserSession } from '../types/core.types.js';
|
|
2
1
|
/**
|
|
3
2
|
* Abstract TriggerService interface.
|
|
4
3
|
*
|
|
@@ -6,12 +5,6 @@ import { CoreSingletonServices, CreateWireServices, CoreServices, CoreUserSessio
|
|
|
6
5
|
* and dispatching to RPC targets or workflow starts.
|
|
7
6
|
*/
|
|
8
7
|
export interface TriggerService {
|
|
9
|
-
/**
|
|
10
|
-
* Set services needed for processing triggers.
|
|
11
|
-
* Called after construction since the trigger service is created before
|
|
12
|
-
* singletonServices are fully assembled.
|
|
13
|
-
*/
|
|
14
|
-
setServices(_singletonServices: CoreSingletonServices, _createWireServices?: CreateWireServices<CoreSingletonServices, CoreServices, CoreUserSession>): void;
|
|
15
8
|
/**
|
|
16
9
|
* Start all triggers
|
|
17
10
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChannelStore } from '../wirings/channel/channel-store.js';
|
|
2
|
-
import { CoreUserSession } from '../types/core.types.js';
|
|
1
|
+
import type { ChannelStore } from '../wirings/channel/channel-store.js';
|
|
2
|
+
import type { CoreUserSession } from '../types/core.types.js';
|
|
3
3
|
export interface SessionService<UserSession extends CoreUserSession> {
|
|
4
4
|
sessionChanged: boolean;
|
|
5
5
|
initial: UserSession | undefined;
|
|
@@ -23,7 +23,7 @@ export declare class PikkuSessionService<UserSession extends CoreUserSession> im
|
|
|
23
23
|
get(): Promise<UserSession> | UserSession | undefined;
|
|
24
24
|
}
|
|
25
25
|
export declare function createMiddlewareSessionWireProps<UserSession extends CoreUserSession>(session: SessionService<UserSession>): {
|
|
26
|
-
session: UserSession |
|
|
26
|
+
session: UserSession | undefined;
|
|
27
27
|
setSession: (s: UserSession) => void;
|
|
28
28
|
getSession: () => UserSession | Promise<UserSession> | undefined;
|
|
29
29
|
hasSessionChanged: () => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SerializedError
|
|
2
|
-
import { WorkflowRun, WorkflowRunWire, StepState, WorkflowStatus } from '../wirings/workflow/workflow.types.js';
|
|
1
|
+
import type { SerializedError } from '../types/core.types.js';
|
|
2
|
+
import type { WorkflowRun, WorkflowRunWire, StepState, WorkflowStatus } from '../wirings/workflow/workflow.types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Interface for workflow orchestration
|
|
5
5
|
* Handles workflow execution, replay, orchestration logic, and run-level state
|
|
@@ -14,7 +14,6 @@ export interface WorkflowService {
|
|
|
14
14
|
withRunLock<T>(id: string, fn: () => Promise<T>): Promise<T>;
|
|
15
15
|
close(): Promise<void>;
|
|
16
16
|
resumeWorkflow(runId: string): Promise<void>;
|
|
17
|
-
setServices(singletonServices: CoreSingletonServices, createWireServices: CreateWireServices | undefined, config: CoreConfig): void;
|
|
18
17
|
startWorkflow<I>(name: string, input: I, wire: WorkflowRunWire, rpcService: any, options?: {
|
|
19
18
|
inline?: boolean;
|
|
20
19
|
startNode?: string;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import type { Logger, LogLevel } from '../services/logger.js';
|
|
2
|
-
import { VariablesService } from '../services/variables-service.js';
|
|
3
|
-
import { SecretService } from '../services/secret-service.js';
|
|
4
|
-
import { SchemaService } from '../services/schema-service.js';
|
|
5
|
-
import { JWTService } from '../services/jwt-service.js';
|
|
6
|
-
import { PikkuHTTP } from '../wirings/http/http.types.js';
|
|
7
|
-
import { PikkuChannel, CorePikkuChannelMiddleware, CorePikkuChannelMiddlewareFactory } from '../wirings/channel/channel.types.js';
|
|
8
|
-
import { PikkuRPC } from '../wirings/rpc/rpc-types.js';
|
|
9
|
-
import { PikkuMCP } from '../wirings/mcp/mcp.types.js';
|
|
10
|
-
import { PikkuScheduledTask } from '../wirings/scheduler/scheduler.types.js';
|
|
11
|
-
import { PikkuQueue, QueueService } from '../wirings/queue/queue.types.js';
|
|
12
|
-
import { PikkuCLI } from '../wirings/cli/cli.types.js';
|
|
13
|
-
import { PikkuWorkflowWire, WorkflowService, WorkflowServiceConfig, WorkflowStepWire } from '../wirings/workflow/workflow.types.js';
|
|
2
|
+
import type { VariablesService } from '../services/variables-service.js';
|
|
3
|
+
import type { SecretService } from '../services/secret-service.js';
|
|
4
|
+
import type { SchemaService } from '../services/schema-service.js';
|
|
5
|
+
import type { JWTService } from '../services/jwt-service.js';
|
|
6
|
+
import type { PikkuHTTP } from '../wirings/http/http.types.js';
|
|
7
|
+
import type { PikkuChannel, CorePikkuChannelMiddleware, CorePikkuChannelMiddlewareFactory } from '../wirings/channel/channel.types.js';
|
|
8
|
+
import type { PikkuRPC } from '../wirings/rpc/rpc-types.js';
|
|
9
|
+
import type { PikkuMCP } from '../wirings/mcp/mcp.types.js';
|
|
10
|
+
import type { PikkuScheduledTask } from '../wirings/scheduler/scheduler.types.js';
|
|
11
|
+
import type { PikkuQueue, QueueService } from '../wirings/queue/queue.types.js';
|
|
12
|
+
import type { PikkuCLI } from '../wirings/cli/cli.types.js';
|
|
13
|
+
import type { PikkuWorkflowWire, WorkflowService, WorkflowServiceConfig, WorkflowStepWire } from '../wirings/workflow/workflow.types.js';
|
|
14
14
|
import type { PikkuGraphWire } from '../wirings/workflow/graph/workflow-graph.types.js';
|
|
15
|
-
import { PikkuTrigger } from '../wirings/trigger/trigger.types.js';
|
|
16
|
-
import { SchedulerService } from '../services/scheduler-service.js';
|
|
17
|
-
import { DeploymentService } from '../services/deployment-service.js';
|
|
18
|
-
import { AIStorageService } from '../services/ai-storage-service.js';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
15
|
+
import type { PikkuTrigger } from '../wirings/trigger/trigger.types.js';
|
|
16
|
+
import type { SchedulerService } from '../services/scheduler-service.js';
|
|
17
|
+
import type { DeploymentService } from '../services/deployment-service.js';
|
|
18
|
+
import type { AIStorageService } from '../services/ai-storage-service.js';
|
|
19
|
+
import type { ContentService } from '../services/content-service.js';
|
|
20
|
+
import type { AIAgentRunnerService } from '../services/ai-agent-runner-service.js';
|
|
21
|
+
import type { AIRunStateService } from '../services/ai-run-state-service.js';
|
|
21
22
|
import type { PikkuAIMiddlewareHooks } from '../wirings/ai-agent/ai-agent.types.js';
|
|
22
23
|
export type PikkuWiringTypes = 'http' | 'scheduler' | 'trigger' | 'channel' | 'rpc' | 'queue' | 'mcp' | 'cli' | 'workflow' | 'agent';
|
|
23
24
|
export interface FunctionServicesMeta {
|
|
@@ -69,10 +70,13 @@ export type FunctionRuntimeMeta = {
|
|
|
69
70
|
expose?: boolean;
|
|
70
71
|
remote?: boolean;
|
|
71
72
|
mcp?: boolean;
|
|
73
|
+
readonly?: boolean;
|
|
72
74
|
sessionless?: boolean;
|
|
73
75
|
version?: number;
|
|
74
76
|
requiresApproval?: boolean;
|
|
75
77
|
contractHash?: string;
|
|
78
|
+
inputHash?: string;
|
|
79
|
+
outputHash?: string;
|
|
76
80
|
};
|
|
77
81
|
export type FunctionMeta = FunctionRuntimeMeta & Partial<{
|
|
78
82
|
name: string;
|
|
@@ -154,6 +158,8 @@ export interface CoreSingletonServices<Config extends CoreConfig = CoreConfig> {
|
|
|
154
158
|
deploymentService?: DeploymentService;
|
|
155
159
|
/** AI agent storage service (threads, messages, working memory) */
|
|
156
160
|
aiStorage?: AIStorageService;
|
|
161
|
+
/** Content service for file storage and retrieval */
|
|
162
|
+
content?: ContentService;
|
|
157
163
|
/** AI agent runner service (model calls + tool loop) */
|
|
158
164
|
aiAgentRunner?: AIAgentRunnerService;
|
|
159
165
|
/** AI run state service (run lifecycle + approval persistence) */
|