@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SerializeOptions } from 'cookie';
|
|
2
2
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
-
import { PikkuError } from '../../errors/error-handler.js';
|
|
4
|
-
import type {
|
|
3
|
+
import type { PikkuError } from '../../errors/error-handler.js';
|
|
4
|
+
import type { CorePikkuMiddleware, CommonWireMeta } from '../../types/core.types.js';
|
|
5
5
|
import type { CorePikkuFunction, CorePikkuFunctionSessionless, CorePikkuPermission, CorePermissionGroup, CorePikkuFunctionConfig } from '../../function/functions.types.js';
|
|
6
6
|
type ExtractHTTPWiringParams<S extends string> = S extends `${string}:${infer Param}/${infer Rest}` ? Param | ExtractHTTPWiringParams<`/${Rest}`> : S extends `${string}:${infer Param}` ? Param : never;
|
|
7
7
|
export type AssertHTTPWiringParams<In, HTTPWiring extends string> = ExtractHTTPWiringParams<HTTPWiring> extends keyof In ? unknown : [
|
|
@@ -18,10 +18,6 @@ export type RunHTTPWiringOptions = Partial<{
|
|
|
18
18
|
bubbleErrors: boolean;
|
|
19
19
|
generateRequestId: () => string;
|
|
20
20
|
}>;
|
|
21
|
-
export type RunHTTPWiringParams = {
|
|
22
|
-
singletonServices: CoreSingletonServices;
|
|
23
|
-
createWireServices?: CreateWireServices<CoreSingletonServices, CoreServices<CoreSingletonServices>, CoreUserSession>;
|
|
24
|
-
};
|
|
25
21
|
/**
|
|
26
22
|
* Represents the HTTP methods supported for API HTTP wirings.
|
|
27
23
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PikkuHTTPResponse } from './http.types.js';
|
|
2
|
-
import { SerializeOptions as CookieSerializeOptions } from 'cookie';
|
|
1
|
+
import type { PikkuHTTPResponse } from './http.types.js';
|
|
2
|
+
import type { SerializeOptions as CookieSerializeOptions } from 'cookie';
|
|
3
3
|
export declare class PikkuFetchHTTPResponse implements PikkuHTTPResponse {
|
|
4
4
|
#private;
|
|
5
5
|
setMode(mode: 'stream'): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { serialize as serializeCookie
|
|
1
|
+
import { serialize as serializeCookie } from 'cookie';
|
|
2
2
|
export class PikkuFetchHTTPResponse {
|
|
3
3
|
#statusCode = 200;
|
|
4
4
|
#headers = new Headers();
|
|
@@ -76,6 +76,11 @@ export class PikkuFetchHTTPResponse {
|
|
|
76
76
|
// return this
|
|
77
77
|
// }
|
|
78
78
|
redirect(location, status = 302) {
|
|
79
|
+
if (!location.startsWith('/') &&
|
|
80
|
+
!location.startsWith('https://') &&
|
|
81
|
+
!location.startsWith('http://')) {
|
|
82
|
+
throw new Error('Invalid redirect location: must be a relative path or absolute URL');
|
|
83
|
+
}
|
|
79
84
|
this.#statusCode = status;
|
|
80
85
|
this.header('Location', location);
|
|
81
86
|
return this;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MatchResult, Router } from './http-router.js';
|
|
2
|
-
import { HTTPMethod } from '../http.types.js';
|
|
1
|
+
import type { MatchResult, Router } from './http-router.js';
|
|
2
|
+
import type { HTTPMethod } from '../http.types.js';
|
|
3
3
|
export declare class PathToRegexRouter implements Router {
|
|
4
4
|
private compiledRoutes;
|
|
5
5
|
private staticRoutes;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type CoreServices, type CoreSingletonServices, type CoreUserSession, type CreateWireServices } from '../../types/core.types.js';
|
|
2
1
|
import type { CoreMCPResource, CoreMCPPrompt, JsonRpcRequest, JsonRpcResponse, JsonRpcErrorResponse, PikkuMCP } from './mcp.types.js';
|
|
3
2
|
import type { CorePikkuFunctionConfig, CorePikkuFunctionSessionless } from '../../function/functions.types.js';
|
|
4
3
|
export declare class MCPError extends Error {
|
|
@@ -6,9 +5,7 @@ export declare class MCPError extends Error {
|
|
|
6
5
|
constructor(error: JsonRpcErrorResponse);
|
|
7
6
|
}
|
|
8
7
|
export type RunMCPEndpointParams<Tools extends string = any> = {
|
|
9
|
-
singletonServices: CoreSingletonServices;
|
|
10
8
|
mcp?: PikkuMCP<Tools>;
|
|
11
|
-
createWireServices?: CreateWireServices<CoreSingletonServices, CoreServices<CoreSingletonServices>, CoreUserSession>;
|
|
12
9
|
};
|
|
13
10
|
export type JsonRpcError = {
|
|
14
11
|
code: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getErrorResponse } from '../../errors/error-handler.js';
|
|
2
2
|
import { closeWireServices } from '../../utils.js';
|
|
3
|
-
import { pikkuState } from '../../pikku-state.js';
|
|
3
|
+
import { pikkuState, getSingletonServices, getCreateWireServices, } from '../../pikku-state.js';
|
|
4
4
|
import { addFunction, runPikkuFunc } from '../../function/function-runner.js';
|
|
5
5
|
import { BadRequestError, NotFoundError, PikkuMissingMetaError, } from '../../errors/errors.js';
|
|
6
6
|
import { PikkuSessionService, createMiddlewareSessionWireProps, } from '../../services/user-session-service.js';
|
|
@@ -85,7 +85,9 @@ export async function runMCPPrompt(request, params, name) {
|
|
|
85
85
|
/**
|
|
86
86
|
* JSON-RPC 2.0 compatible MCP endpoint runner
|
|
87
87
|
*/
|
|
88
|
-
async function runMCPPikkuFunc(request, type, name, mcp, pikkuFuncId, {
|
|
88
|
+
async function runMCPPikkuFunc(request, type, name, mcp, pikkuFuncId, { mcp: mcpWire }) {
|
|
89
|
+
const singletonServices = getSingletonServices();
|
|
90
|
+
const createWireServices = getCreateWireServices();
|
|
89
91
|
let wireServices;
|
|
90
92
|
try {
|
|
91
93
|
if (request.jsonrpc !== '2.0') {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CorePermissionGroup, CorePikkuFunctionConfig, CorePikkuFunctionSessionless, CorePikkuPermission } from '../../function/functions.types.js';
|
|
2
|
-
import { CorePikkuMiddleware, MiddlewareMetadata, PermissionMetadata } from '../../types/core.types.js';
|
|
1
|
+
import type { CorePermissionGroup, CorePikkuFunctionConfig, CorePikkuFunctionSessionless, CorePikkuPermission } from '../../function/functions.types.js';
|
|
2
|
+
import type { CorePikkuMiddleware, MiddlewareMetadata, PermissionMetadata } from '../../types/core.types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Extract URI parameters from MCP resource URI template.
|
|
5
5
|
* E.g., "user/{userId}/post/{postId}" => "userId" | "postId"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OAuth2Token } from './oauth2.types.js';
|
|
2
|
-
import { OAuth2CredentialConfig } from '../secret/secret.types.js';
|
|
3
|
-
import { SecretService } from '../../services/secret-service.js';
|
|
1
|
+
import type { OAuth2Token } from './oauth2.types.js';
|
|
2
|
+
import type { OAuth2CredentialConfig } from '../secret/secret.types.js';
|
|
3
|
+
import type { SecretService } from '../../services/secret-service.js';
|
|
4
4
|
export declare class OAuth2Client {
|
|
5
5
|
private oauth2Config;
|
|
6
6
|
private appCredentialSecretId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ConfigValidationResult, CoreQueueWorker, JobOptions, PikkuJobConfig, PikkuWorkerConfig, PikkuQueue, QueueJob, QueueJobStatus, QueueService, QueueWorkers, QueueWorkersMeta, } from './queue.types.js';
|
|
2
|
-
export { wireQueueWorker, runQueueJob,
|
|
2
|
+
export { wireQueueWorker, runQueueJob, getQueueWorkers, removeQueueWorker, QueueJobDiscardedError, QueueJobFailedError, } from './queue-runner.js';
|
|
3
3
|
export { validateWorkerConfig } from './validate-worker-config.js';
|
|
4
4
|
export type { QueueConfigMapping } from './validate-worker-config.js';
|
|
5
5
|
export { registerQueueWorkers } from './register-queue-helper.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Queue processor management
|
|
2
|
-
export { wireQueueWorker, runQueueJob,
|
|
2
|
+
export { wireQueueWorker, runQueueJob, getQueueWorkers, removeQueueWorker, QueueJobDiscardedError, QueueJobFailedError, } from './queue-runner.js';
|
|
3
3
|
// Configuration validation
|
|
4
4
|
export { validateWorkerConfig } from './validate-worker-config.js';
|
|
5
5
|
// Queue registration helper
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import type { CoreServices } from '../../types/core.types.js';
|
|
2
1
|
import type { CoreQueueWorker, QueueJob } from './queue.types.js';
|
|
3
2
|
import type { CorePikkuFunctionConfig, CorePikkuFunctionSessionless } from '../../function/functions.types.js';
|
|
4
3
|
import { PikkuError } from '../../errors/error-handler.js';
|
|
5
|
-
import { CreateWireServices } from '../../types/core.types.js';
|
|
6
4
|
/**
|
|
7
5
|
* Error class for when a queue job is explicitly failed
|
|
8
6
|
*/
|
|
@@ -30,16 +28,7 @@ export declare function removeQueueWorker(name: string): Promise<void>;
|
|
|
30
28
|
/**
|
|
31
29
|
* Process a single queue job - this function is called by queue consumers
|
|
32
30
|
*/
|
|
33
|
-
export declare function runQueueJob({
|
|
34
|
-
singletonServices: CoreServices;
|
|
35
|
-
createWireServices?: CreateWireServices;
|
|
31
|
+
export declare function runQueueJob({ job, updateProgress, }: {
|
|
36
32
|
job: QueueJob;
|
|
37
33
|
updateProgress?: (progress: number | string | object) => Promise<void>;
|
|
38
34
|
}): Promise<void>;
|
|
39
|
-
export declare const createQueueJobRunner: ({ singletonServices, createWireServices, }: {
|
|
40
|
-
singletonServices: CoreServices;
|
|
41
|
-
createWireServices?: CreateWireServices;
|
|
42
|
-
}) => ({ job, updateProgress, }: {
|
|
43
|
-
job: QueueJob;
|
|
44
|
-
updateProgress?: (progress: number | string | object) => Promise<void>;
|
|
45
|
-
}) => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getErrorResponse, PikkuError } from '../../errors/error-handler.js';
|
|
2
2
|
import { PikkuMissingMetaError } from '../../errors/errors.js';
|
|
3
|
-
import { pikkuState } from '../../pikku-state.js';
|
|
3
|
+
import { getSingletonServices, getCreateWireServices, pikkuState, } from '../../pikku-state.js';
|
|
4
4
|
import { addFunction, runPikkuFunc } from '../../function/function-runner.js';
|
|
5
5
|
/**
|
|
6
6
|
* Error class for queue processor not found
|
|
@@ -70,7 +70,9 @@ export async function removeQueueWorker(name) {
|
|
|
70
70
|
/**
|
|
71
71
|
* Process a single queue job - this function is called by queue consumers
|
|
72
72
|
*/
|
|
73
|
-
export async function runQueueJob({
|
|
73
|
+
export async function runQueueJob({ job, updateProgress, }) {
|
|
74
|
+
const singletonServices = getSingletonServices();
|
|
75
|
+
const createWireServices = getCreateWireServices();
|
|
74
76
|
const logger = singletonServices.logger;
|
|
75
77
|
const meta = pikkuState(null, 'queue', 'meta');
|
|
76
78
|
const processorMeta = meta[job.queueName];
|
|
@@ -128,13 +130,3 @@ export async function runQueueJob({ singletonServices, createWireServices, job,
|
|
|
128
130
|
throw error;
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
|
-
export const createQueueJobRunner = ({ singletonServices, createWireServices, }) => {
|
|
132
|
-
return async ({ job, updateProgress, }) => {
|
|
133
|
-
await runQueueJob({
|
|
134
|
-
singletonServices,
|
|
135
|
-
createWireServices,
|
|
136
|
-
job,
|
|
137
|
-
updateProgress,
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { CommonWireMeta } from '../../types/core.types.js';
|
|
2
|
-
import { CorePikkuFunctionConfig } from '../../function/functions.types.js';
|
|
3
|
-
import { QueueConfigMapping } from './validate-worker-config.js';
|
|
4
|
-
import { Logger } from '../../services/logger.js';
|
|
1
|
+
import type { CommonWireMeta } from '../../types/core.types.js';
|
|
2
|
+
import type { CorePikkuFunctionConfig } from '../../function/functions.types.js';
|
|
3
|
+
import type { QueueConfigMapping } from './validate-worker-config.js';
|
|
5
4
|
/**
|
|
6
5
|
* Configuration for queue workers - how jobs are processed
|
|
7
6
|
*/
|
|
@@ -125,11 +124,6 @@ export interface QueueWorkers {
|
|
|
125
124
|
supportsResults: boolean;
|
|
126
125
|
/** Configuration mapping for validation */
|
|
127
126
|
configMappings: QueueConfigMapping;
|
|
128
|
-
/** Set runtime queue job runner callback and logger */
|
|
129
|
-
setJobRunner(runJob: (params: {
|
|
130
|
-
job: QueueJob;
|
|
131
|
-
updateProgress?: (progress: number | string | object) => Promise<void>;
|
|
132
|
-
}) => Promise<void>, logger: Logger): void;
|
|
133
127
|
/** Scan state and register all compatible processors */
|
|
134
128
|
registerQueues(): Promise<Record<string, ConfigValidationResult[]>>;
|
|
135
129
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ConfigValidationResult, CoreQueueWorker } from './queue.types.js';
|
|
2
|
-
import { QueueConfigMapping } from './validate-worker-config.js';
|
|
3
|
-
import { Logger } from '../../services/logger.js';
|
|
2
|
+
import type { QueueConfigMapping } from './validate-worker-config.js';
|
|
3
|
+
import type { Logger } from '../../services/logger.js';
|
|
4
4
|
/**
|
|
5
5
|
* Queue processor registration callback
|
|
6
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getQueueWorkers } from './queue-runner.js';
|
|
2
|
-
import { validateWorkerConfig
|
|
2
|
+
import { validateWorkerConfig } from './validate-worker-config.js';
|
|
3
3
|
/**
|
|
4
4
|
* Helper function to register queue processors with validation
|
|
5
5
|
* This centralizes the common logic for looping over processors and validating configs
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { CoreServices,
|
|
1
|
+
import type { CoreServices, PikkuWire } from '../../types/core.types.js';
|
|
2
2
|
import type { SessionService } from '../../services/user-session-service.js';
|
|
3
3
|
import type { CoreUserSession } from '../../types/core.types.js';
|
|
4
4
|
import { PikkuError } from '../../errors/error-handler.js';
|
|
5
|
-
import { PikkuRPC } from './rpc-types.js';
|
|
5
|
+
import type { PikkuRPC } from './rpc-types.js';
|
|
6
6
|
export declare class RPCNotFoundError extends PikkuError {
|
|
7
7
|
readonly rpcName: string;
|
|
8
8
|
constructor(rpcName: string);
|
|
9
9
|
}
|
|
10
10
|
import type { AIAgentInput } from '../ai-agent/ai-agent.types.js';
|
|
11
|
+
import type { StreamAIAgentOptions } from '../ai-agent/ai-agent-prepare.js';
|
|
11
12
|
export declare class ContextAwareRPCService {
|
|
12
13
|
private services;
|
|
13
14
|
private wire;
|
|
@@ -19,12 +20,12 @@ export declare class ContextAwareRPCService {
|
|
|
19
20
|
rpcExposed(funcName: string, data: any): Promise<any>;
|
|
20
21
|
rpc<In = any, Out = any>(funcName: string, data: In): Promise<Out>;
|
|
21
22
|
/**
|
|
22
|
-
* Invoke a function from an
|
|
23
|
-
*
|
|
23
|
+
* Invoke a function from an addon package
|
|
24
|
+
* Addon packages register their functions in pikkuState under their package name.
|
|
24
25
|
* The function is executed using the parent services (shared singleton services).
|
|
25
26
|
* @private
|
|
26
27
|
*/
|
|
27
|
-
private
|
|
28
|
+
private invokeAddonFunction;
|
|
28
29
|
rpcWithWire<In = any, Out = any>(rpcName: string, data: In, wire: PikkuWire): Promise<Out>;
|
|
29
30
|
startWorkflow<In = any>(workflowName: string, input: In, options?: {
|
|
30
31
|
startNode?: string;
|
|
@@ -36,14 +37,35 @@ export declare class ContextAwareRPCService {
|
|
|
36
37
|
}): Promise<{
|
|
37
38
|
runId: string;
|
|
38
39
|
}>;
|
|
39
|
-
agent(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
get agent(): {
|
|
41
|
+
run: (agentName: string, input: AIAgentInput) => Promise<{
|
|
42
|
+
runId: string;
|
|
43
|
+
result: {};
|
|
44
|
+
usage: {
|
|
45
|
+
inputTokens: number;
|
|
46
|
+
outputTokens: number;
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
49
|
+
stream: (agentName: string, input: {
|
|
50
|
+
message: string;
|
|
51
|
+
threadId: string;
|
|
52
|
+
resourceId: string;
|
|
53
|
+
} | Record<string, unknown>, options?: StreamAIAgentOptions) => Promise<void>;
|
|
54
|
+
resume: (runId: string, input: {
|
|
55
|
+
toolCallId: string;
|
|
56
|
+
approved: boolean;
|
|
57
|
+
}, options?: StreamAIAgentOptions) => Promise<void>;
|
|
58
|
+
approve: (runId: string, approvals: {
|
|
59
|
+
toolCallId: string;
|
|
60
|
+
approved: boolean;
|
|
61
|
+
}[], expectedAgentName?: string) => Promise<{
|
|
62
|
+
status: "resumed" | "suspended";
|
|
63
|
+
runId: string;
|
|
64
|
+
approved: string[];
|
|
65
|
+
rejected: string[];
|
|
66
|
+
remainingApprovals: number;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
47
69
|
remote<In = any, Out = any>(funcName: string, data: In): Promise<Out>;
|
|
48
70
|
}
|
|
49
71
|
export declare class PikkuRPCService<Services extends CoreServices, TypedRPC = PikkuRPC> {
|
|
@@ -52,7 +74,7 @@ export declare class PikkuRPCService<Services extends CoreServices, TypedRPC = P
|
|
|
52
74
|
sessionService?: SessionService<CoreUserSession>;
|
|
53
75
|
} | undefined, depth?: number): TypedRPC;
|
|
54
76
|
}
|
|
55
|
-
export declare const rpcService: PikkuRPCService<CoreSingletonServices<{
|
|
77
|
+
export declare const rpcService: PikkuRPCService<import("../../types/core.types.js").CoreSingletonServices<{
|
|
56
78
|
logLevel?: import("../../services/logger.js").LogLevel;
|
|
57
79
|
secrets?: {};
|
|
58
80
|
workflow?: import("../workflow/workflow.types.js").WorkflowServiceConfig;
|
|
@@ -12,6 +12,8 @@ export class RPCNotFoundError extends PikkuError {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
import { runAIAgent } from '../ai-agent/ai-agent-runner.js';
|
|
15
|
+
import { streamAIAgent, resumeAIAgent } from '../ai-agent/ai-agent-stream.js';
|
|
16
|
+
import { approveAIAgent } from '../ai-agent/ai-agent-registry.js';
|
|
15
17
|
/**
|
|
16
18
|
* Resolve a namespaced function reference to package and function names
|
|
17
19
|
* Uses pikkuState to look up the namespace -> package mapping
|
|
@@ -23,12 +25,13 @@ const resolveNamespace = (namespacedFunction) => {
|
|
|
23
25
|
}
|
|
24
26
|
const namespace = namespacedFunction.substring(0, colonIndex);
|
|
25
27
|
const functionName = namespacedFunction.substring(colonIndex + 1);
|
|
26
|
-
const
|
|
27
|
-
const pkgConfig =
|
|
28
|
+
const addons = pikkuState(null, 'rpc', 'addons');
|
|
29
|
+
const pkgConfig = addons.get(namespace);
|
|
28
30
|
if (!pkgConfig) {
|
|
29
31
|
return null;
|
|
30
32
|
}
|
|
31
33
|
return {
|
|
34
|
+
namespace,
|
|
32
35
|
package: pkgConfig.package,
|
|
33
36
|
function: functionName,
|
|
34
37
|
};
|
|
@@ -90,7 +93,7 @@ export class ContextAwareRPCService {
|
|
|
90
93
|
};
|
|
91
94
|
// Check if it's a namespaced function call (e.g., 'stripe:createCharge')
|
|
92
95
|
if (funcName.includes(':')) {
|
|
93
|
-
return this.
|
|
96
|
+
return this.invokeAddonFunction(funcName, data, updatedWire);
|
|
94
97
|
}
|
|
95
98
|
// Main package function
|
|
96
99
|
return runPikkuFunc('rpc', funcName, getPikkuFunctionName(funcName), {
|
|
@@ -101,37 +104,40 @@ export class ContextAwareRPCService {
|
|
|
101
104
|
});
|
|
102
105
|
}
|
|
103
106
|
/**
|
|
104
|
-
* Invoke a function from an
|
|
105
|
-
*
|
|
107
|
+
* Invoke a function from an addon package
|
|
108
|
+
* Addon packages register their functions in pikkuState under their package name.
|
|
106
109
|
* The function is executed using the parent services (shared singleton services).
|
|
107
110
|
* @private
|
|
108
111
|
*/
|
|
109
|
-
async
|
|
112
|
+
async invokeAddonFunction(namespacedFunction, data, wire) {
|
|
110
113
|
// Resolve namespace to package name
|
|
111
114
|
const resolved = resolveNamespace(namespacedFunction);
|
|
112
115
|
if (!resolved) {
|
|
113
116
|
throw new Error(`Unknown namespace in function reference: ${namespacedFunction}. ` +
|
|
114
|
-
`Make sure the package is registered in
|
|
117
|
+
`Make sure the package is registered in addons config.`);
|
|
115
118
|
}
|
|
116
|
-
// Get the function meta from the
|
|
117
|
-
//
|
|
118
|
-
const
|
|
119
|
-
const funcMeta =
|
|
119
|
+
// Get the function meta from the addon package
|
|
120
|
+
// Addon packages use function meta, not RPC meta
|
|
121
|
+
const addonFunctionMeta = pikkuState(resolved.package, 'function', 'meta');
|
|
122
|
+
const funcMeta = addonFunctionMeta[resolved.function];
|
|
120
123
|
if (!funcMeta) {
|
|
121
124
|
throw new Error(`Function '${resolved.function}' not found in package '${resolved.package}'. ` +
|
|
122
|
-
`Available functions: ${Object.keys(
|
|
125
|
+
`Available functions: ${Object.keys(addonFunctionMeta).join(', ') || '(none)'}`);
|
|
123
126
|
}
|
|
124
127
|
const funcName = funcMeta.pikkuFuncId || resolved.function;
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
const addonConfig = pikkuState(null, 'rpc', 'addons').get(resolved.namespace);
|
|
129
|
+
const auth = addonConfig?.auth ?? this.options.requiresAuth;
|
|
130
|
+
const tags = [...(addonConfig?.tags ?? []), ...(funcMeta.tags ?? [])];
|
|
131
|
+
// Execute the function using runPikkuFunc with the addon package's state
|
|
132
|
+
// We use the parent services (this.services) since addon packages share services
|
|
127
133
|
// Pass the function's tags so tag-based middleware/permissions are applied
|
|
128
134
|
return runPikkuFunc('rpc', namespacedFunction, funcName, {
|
|
129
|
-
auth
|
|
135
|
+
auth,
|
|
130
136
|
singletonServices: this.services,
|
|
131
137
|
data: () => data,
|
|
132
138
|
wire,
|
|
133
139
|
packageName: resolved.package,
|
|
134
|
-
tags
|
|
140
|
+
tags,
|
|
135
141
|
});
|
|
136
142
|
}
|
|
137
143
|
async rpcWithWire(rpcName, data, wire) {
|
|
@@ -166,15 +172,35 @@ export class ContextAwareRPCService {
|
|
|
166
172
|
};
|
|
167
173
|
return this.services.workflowService.startWorkflow(workflowName, input, wire, this, options);
|
|
168
174
|
}
|
|
169
|
-
|
|
170
|
-
const result = await runAIAgent(agentName, input, {
|
|
171
|
-
singletonServices: this.services,
|
|
172
|
-
sessionService: this.options.sessionService,
|
|
173
|
-
});
|
|
175
|
+
get agent() {
|
|
174
176
|
return {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
177
|
+
run: async (agentName, input) => {
|
|
178
|
+
const result = await runAIAgent(agentName, input, {
|
|
179
|
+
sessionService: this.options.sessionService,
|
|
180
|
+
});
|
|
181
|
+
return {
|
|
182
|
+
runId: result.runId,
|
|
183
|
+
result: result.object ?? result.text,
|
|
184
|
+
usage: result.usage,
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
stream: async (agentName, input, options) => {
|
|
188
|
+
const channel = this.wire.channel;
|
|
189
|
+
if (!channel)
|
|
190
|
+
throw new Error('No channel available for streaming');
|
|
191
|
+
await streamAIAgent(agentName, input, channel, { sessionService: this.options.sessionService }, undefined, options);
|
|
192
|
+
},
|
|
193
|
+
resume: async (runId, input, options) => {
|
|
194
|
+
const channel = this.wire.channel;
|
|
195
|
+
if (!channel)
|
|
196
|
+
throw new Error('No channel available for streaming');
|
|
197
|
+
await resumeAIAgent({ runId, ...input }, channel, { sessionService: this.options.sessionService }, options);
|
|
198
|
+
},
|
|
199
|
+
approve: async (runId, approvals, expectedAgentName) => {
|
|
200
|
+
if (!this.services.aiRunState)
|
|
201
|
+
throw new Error('AIRunStateService not available');
|
|
202
|
+
return approveAIAgent(this.services.aiRunState, runId, approvals, expectedAgentName);
|
|
203
|
+
},
|
|
178
204
|
};
|
|
179
205
|
}
|
|
180
206
|
async remote(funcName, data) {
|
|
@@ -185,8 +211,8 @@ export class ContextAwareRPCService {
|
|
|
185
211
|
const colonIndex = funcName.indexOf(':');
|
|
186
212
|
if (colonIndex !== -1) {
|
|
187
213
|
const namespace = funcName.substring(0, colonIndex);
|
|
188
|
-
const
|
|
189
|
-
const pkgConfig =
|
|
214
|
+
const addons = pikkuState(null, 'rpc', 'addons');
|
|
215
|
+
const pkgConfig = addons.get(namespace);
|
|
190
216
|
endpoint = pkgConfig?.rpcEndpoint;
|
|
191
217
|
}
|
|
192
218
|
if (!endpoint && this.services.deploymentService) {
|
|
@@ -197,7 +223,7 @@ export class ContextAwareRPCService {
|
|
|
197
223
|
}
|
|
198
224
|
if (!endpoint) {
|
|
199
225
|
throw new Error(`No endpoint configured for remote RPC: ${funcName}. ` +
|
|
200
|
-
`Configure rpcEndpoint in
|
|
226
|
+
`Configure rpcEndpoint in addons config or set up a DeploymentService.`);
|
|
201
227
|
}
|
|
202
228
|
let secret;
|
|
203
229
|
if (this.services.secrets) {
|
|
@@ -267,7 +293,9 @@ export class PikkuRPCService {
|
|
|
267
293
|
remote: serviceRPC.remote.bind(serviceRPC),
|
|
268
294
|
exposed: serviceRPC.rpcExposed.bind(serviceRPC),
|
|
269
295
|
startWorkflow: serviceRPC.startWorkflow.bind(serviceRPC),
|
|
270
|
-
|
|
296
|
+
get agent() {
|
|
297
|
+
return serviceRPC.agent;
|
|
298
|
+
},
|
|
271
299
|
rpcWithWire: serviceRPC.rpcWithWire.bind(serviceRPC),
|
|
272
300
|
};
|
|
273
301
|
}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
|
-
export type PikkuRPC<Invoke extends Function = any, Remote extends Function = any, startWorkflow extends Function = any,
|
|
1
|
+
export type PikkuRPC<Invoke extends Function = any, Remote extends Function = any, startWorkflow extends Function = any, AgentRun extends Function = any, AgentStream extends Function = any> = {
|
|
2
2
|
depth: number;
|
|
3
3
|
global: boolean;
|
|
4
4
|
invoke: Invoke;
|
|
5
5
|
remote: Remote;
|
|
6
6
|
exposed: (name: string, data: any) => Promise<any>;
|
|
7
7
|
startWorkflow: startWorkflow;
|
|
8
|
-
agent:
|
|
8
|
+
agent: {
|
|
9
|
+
run: AgentRun;
|
|
10
|
+
stream: AgentStream;
|
|
11
|
+
resume: (runId: string, input: {
|
|
12
|
+
toolCallId: string;
|
|
13
|
+
approved: boolean;
|
|
14
|
+
}, options?: any) => Promise<void>;
|
|
15
|
+
approve: (runId: string, approvals: {
|
|
16
|
+
toolCallId: string;
|
|
17
|
+
approved: boolean;
|
|
18
|
+
}[], expectedAgentName?: string) => Promise<any>;
|
|
19
|
+
};
|
|
9
20
|
};
|
|
10
21
|
export type RPCMeta = {
|
|
11
22
|
pikkuFuncId: string;
|
|
@@ -23,6 +34,7 @@ export interface RPCHandler<Input, Output> {
|
|
|
23
34
|
* Resolved function reference from namespace
|
|
24
35
|
*/
|
|
25
36
|
export interface ResolvedFunction {
|
|
37
|
+
namespace: string;
|
|
26
38
|
package: string;
|
|
27
39
|
function: string;
|
|
28
40
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type WireAddonConfig = {
|
|
2
|
+
name: string;
|
|
3
|
+
package: string;
|
|
4
|
+
rpcEndpoint?: string;
|
|
5
|
+
auth?: boolean;
|
|
6
|
+
tags?: string[];
|
|
7
|
+
secretOverrides?: Record<string, string>;
|
|
8
|
+
variableOverrides?: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
export declare const wireAddon: (config: WireAddonConfig) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { runScheduledTask,
|
|
1
|
+
export { runScheduledTask, wireScheduler, getScheduledTasks, } from './scheduler-runner.js';
|
|
2
2
|
export { logSchedulers } from './log-schedulers.js';
|
|
3
3
|
export type { CoreScheduledTask, ScheduledTasksMeta, PikkuScheduledTask, } from './scheduler.types.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { runScheduledTask,
|
|
1
|
+
export { runScheduledTask, wireScheduler, getScheduledTasks, } from './scheduler-runner.js';
|
|
2
2
|
export { logSchedulers } from './log-schedulers.js';
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { CoreUserSession } from '../../types/core.types.js';
|
|
2
2
|
import type { CoreScheduledTask } from './scheduler.types.js';
|
|
3
|
-
import { CorePikkuFunctionConfig, CorePikkuFunctionSessionless } from '../../function/functions.types.js';
|
|
4
|
-
import { SchedulerRuntimeHandlers } from '../../services/scheduler-service.js';
|
|
3
|
+
import type { CorePikkuFunctionConfig, CorePikkuFunctionSessionless } from '../../function/functions.types.js';
|
|
5
4
|
export type RunScheduledTasksParams = {
|
|
6
5
|
name: string;
|
|
7
6
|
session?: CoreUserSession;
|
|
8
|
-
singletonServices: CoreSingletonServices;
|
|
9
|
-
createWireServices?: CreateWireServices<CoreSingletonServices, CoreServices<CoreSingletonServices>, CoreUserSession>;
|
|
10
7
|
};
|
|
11
8
|
export declare const wireScheduler: <PikkuFunctionConfig extends CorePikkuFunctionConfig<CorePikkuFunctionSessionless<void, void>>>(scheduledTask: CoreScheduledTask<PikkuFunctionConfig>) => void;
|
|
12
|
-
export declare function runScheduledTask({ name, session,
|
|
9
|
+
export declare function runScheduledTask({ name, session, }: RunScheduledTasksParams): Promise<void>;
|
|
13
10
|
export declare const getScheduledTasks: () => Map<string, CoreScheduledTask>;
|
|
14
|
-
export declare const createSchedulerRuntimeHandlers: ({ singletonServices, createWireServices, }: {
|
|
15
|
-
singletonServices: CoreSingletonServices;
|
|
16
|
-
createWireServices?: CreateWireServices<CoreSingletonServices, CoreServices<CoreSingletonServices>, CoreUserSession>;
|
|
17
|
-
}) => SchedulerRuntimeHandlers;
|