@stateflowx/runtime 0.4.16 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/init/initialize-execution-artifacts.d.ts +2 -3
- package/dist/core/init/initialize-execution-artifacts.js +1 -1
- package/dist/core/init/initialize-execution-artifacts.js.map +1 -1
- package/dist/core/init/initialize-execution-events.d.ts +2 -2
- package/dist/core/init/initialize-execution-events.js.map +1 -1
- package/dist/core/init/initialize-execution.d.ts +2 -3
- package/dist/core/init/initialize-execution.js +6 -6
- package/dist/core/init/initialize-execution.js.map +1 -1
- package/dist/core/init/initialize-runtime-capabilities.d.ts +2 -3
- package/dist/core/init/initialize-runtime-capabilities.js +3 -3
- package/dist/core/init/initialize-runtime-capabilities.js.map +1 -1
- package/dist/core/runtime/Runtime.d.ts +18 -0
- package/dist/core/runtime/Runtime.js +25 -0
- package/dist/core/runtime/Runtime.js.map +1 -0
- package/dist/core/runtime/bootstrap.d.ts +2 -2
- package/dist/core/runtime/bootstrap.js +19 -15
- package/dist/core/runtime/bootstrap.js.map +1 -1
- package/dist/core/runtime/create-runtime-context.d.ts +3 -4
- package/dist/core/runtime/create-runtime-context.js +58 -23
- package/dist/core/runtime/create-runtime-context.js.map +1 -1
- package/dist/core/runtime/create-runtime.d.ts +2 -2
- package/dist/core/runtime/create-runtime.js +11 -8
- package/dist/core/runtime/create-runtime.js.map +1 -1
- package/dist/core/runtime/normalize-runtime-config.d.ts +2 -2
- package/dist/core/runtime/{runtime-config.interface.d.ts → runtime-options.interface.d.ts} +1 -1
- package/dist/core/runtime/runtime-options.interface.js +2 -0
- package/dist/core/runtime/runtime-options.interface.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/core/runtime/runtime-config.interface.js +0 -2
- package/dist/core/runtime/runtime-config.interface.js.map +0 -1
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function initializeExecutionArtifacts(_runtime: RuntimeConfig, _config: CreateRuntimeConfig): void;
|
|
1
|
+
import { RuntimeOptions } from '../runtime/runtime-options.interface.js';
|
|
2
|
+
export declare function initializeExecutionArtifacts(_runtime: RuntimeOptions): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-execution-artifacts.js","sourceRoot":"","sources":["../../../src/core/init/initialize-execution-artifacts.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,4BAA4B,CAC1C,
|
|
1
|
+
{"version":3,"file":"initialize-execution-artifacts.js","sourceRoot":"","sources":["../../../src/core/init/initialize-execution-artifacts.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,4BAA4B,CAC1C,QAAwB;IAExB,EAAE;IACF,QAAQ;IACR,+BAA+B;IAC/B,EAAE;AACJ,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function initializeExecutionEvents(runtime:
|
|
1
|
+
import { RuntimeOptions } from '../runtime/runtime-options.interface.js';
|
|
2
|
+
export declare function initializeExecutionEvents(runtime: RuntimeOptions): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-execution-events.js","sourceRoot":"","sources":["../../../src/core/init/initialize-execution-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAIjE,MAAM,UAAU,yBAAyB,CAAC,
|
|
1
|
+
{"version":3,"file":"initialize-execution-events.js","sourceRoot":"","sources":["../../../src/core/init/initialize-execution-events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAIjE,MAAM,UAAU,yBAAyB,CAAC,OAAuB;IAC/D,OAAO,CAAC,MAAM,KAAK,IAAI,eAAe,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function initializeExecution(runtime: RuntimeConfig, config: CreateRuntimeConfig): void;
|
|
1
|
+
import { RuntimeOptions } from '../runtime/runtime-options.interface.js';
|
|
2
|
+
export declare function initializeExecution(options: RuntimeOptions): void;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { initializeExecutionArtifacts } from './initialize-execution-artifacts.js';
|
|
2
2
|
import { initializeExecutionEvents } from './initialize-execution-events.js';
|
|
3
|
-
export function initializeExecution(
|
|
4
|
-
if (!
|
|
3
|
+
export function initializeExecution(options) {
|
|
4
|
+
if (!options.execution?.enabled) {
|
|
5
5
|
return;
|
|
6
6
|
}
|
|
7
7
|
//
|
|
8
8
|
// execution events
|
|
9
|
-
if (
|
|
10
|
-
initializeExecutionEvents(
|
|
9
|
+
if (options.execution?.events?.enabled) {
|
|
10
|
+
initializeExecutionEvents(options);
|
|
11
11
|
}
|
|
12
12
|
//
|
|
13
13
|
// Execution artifacts
|
|
14
14
|
//
|
|
15
|
-
if (
|
|
16
|
-
initializeExecutionArtifacts(
|
|
15
|
+
if (options.execution?.artifacts?.enabled) {
|
|
16
|
+
initializeExecutionArtifacts(options);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=initialize-execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-execution.js","sourceRoot":"","sources":["../../../src/core/init/initialize-execution.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,MAAM,UAAU,mBAAmB,CACjC,
|
|
1
|
+
{"version":3,"file":"initialize-execution.js","sourceRoot":"","sources":["../../../src/core/init/initialize-execution.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAEnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,MAAM,UAAU,mBAAmB,CACjC,OAAuB;IAEvB,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,EAAE;IACF,mBAAmB;IACnB,IAAI,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QACvC,yBAAyB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;IAED,EAAE;IACF,sBAAsB;IACtB,EAAE;IACF,IAAI,OAAO,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;QAC1C,4BAA4B,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function initializeRuntimeCapabilities(runtime: RuntimeConfig, config: CreateRuntimeConfig): void;
|
|
1
|
+
import { RuntimeOptions } from '../runtime/runtime-options.interface.js';
|
|
2
|
+
export declare function initializeRuntimeCapabilities(options: RuntimeOptions): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { initializeExecution } from './initialize-execution.js';
|
|
2
|
-
export function initializeRuntimeCapabilities(
|
|
2
|
+
export function initializeRuntimeCapabilities(options) {
|
|
3
3
|
//
|
|
4
4
|
// Execution capability
|
|
5
5
|
//
|
|
6
|
-
if (
|
|
7
|
-
initializeExecution(
|
|
6
|
+
if (options.execution?.enabled) {
|
|
7
|
+
initializeExecution(options);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=initialize-runtime-capabilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-runtime-capabilities.js","sourceRoot":"","sources":["../../../src/core/init/initialize-runtime-capabilities.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,UAAU,6BAA6B,CAC3C,
|
|
1
|
+
{"version":3,"file":"initialize-runtime-capabilities.js","sourceRoot":"","sources":["../../../src/core/init/initialize-runtime-capabilities.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,UAAU,6BAA6B,CAC3C,OAAuB;IAEvB,EAAE;IACF,uBAAuB;IACvB,EAAE;IACF,IAAI,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;QAC/B,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AgentManager } from "../agent/agent-manager.js";
|
|
2
|
+
import { RuntimeEventBus } from "../events/runtime-event-bus.js";
|
|
3
|
+
import { ProviderManager } from "../provider/provider.manager.js";
|
|
4
|
+
import { ServiceManager } from "../service/service.manager.js";
|
|
5
|
+
import { ExecutionManager } from "./execution/execution-manager.js";
|
|
6
|
+
import { RuntimeOptions } from "./runtime-options.interface.js";
|
|
7
|
+
export declare class Runtime {
|
|
8
|
+
readonly apiKey: string;
|
|
9
|
+
readonly db: import("../db.interface.js").DB;
|
|
10
|
+
readonly transport: import("../transport/transport.interface.js").Transport;
|
|
11
|
+
readonly protocol: import("../protocol/protocol.interface.js").Protocol;
|
|
12
|
+
readonly events: RuntimeEventBus;
|
|
13
|
+
readonly execution: ExecutionManager;
|
|
14
|
+
readonly providers: ProviderManager;
|
|
15
|
+
readonly services: ServiceManager;
|
|
16
|
+
readonly agents: AgentManager;
|
|
17
|
+
constructor(options: RuntimeOptions);
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AgentManager } from "../agent/agent-manager.js";
|
|
2
|
+
import { RuntimeEventBus } from "../events/runtime-event-bus.js";
|
|
3
|
+
import { ProviderManager } from "../provider/provider.manager.js";
|
|
4
|
+
import { ServiceManager } from "../service/service.manager.js";
|
|
5
|
+
import { InMemoryDB } from "../storage/in-memory.db.js";
|
|
6
|
+
import { ExecutionManager } from "./execution/execution-manager.js";
|
|
7
|
+
export class Runtime {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.apiKey = options.apiKey;
|
|
10
|
+
this.db = options.db ?? new InMemoryDB();
|
|
11
|
+
this.transport = options.transport;
|
|
12
|
+
this.protocol = options.protocol;
|
|
13
|
+
this.events =
|
|
14
|
+
options.events ?? new RuntimeEventBus();
|
|
15
|
+
this.providers =
|
|
16
|
+
new ProviderManager(options.providers ?? []);
|
|
17
|
+
this.services =
|
|
18
|
+
new ServiceManager(options.services ?? []);
|
|
19
|
+
this.agents =
|
|
20
|
+
new AgentManager(options.agents ?? []);
|
|
21
|
+
this.execution =
|
|
22
|
+
new ExecutionManager();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=Runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Runtime.js","sourceRoot":"","sources":["../../../src/core/runtime/Runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAKpE,MAAM,OAAO,OAAO;IAoBhB,YAAY,OAAuB;QAE/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE7B,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,IAAI,UAAU,EAAE,CAAC;QAEzC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAEnC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAEjC,IAAI,CAAC,MAAM;YACP,OAAO,CAAC,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QAE5C,IAAI,CAAC,SAAS;YACV,IAAI,eAAe,CAAC,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QAEjD,IAAI,CAAC,QAAQ;YACT,IAAI,cAAc,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QAE/C,IAAI,CAAC,MAAM;YACP,IAAI,YAAY,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QAE3C,IAAI,CAAC,SAAS;YACV,IAAI,gBAAgB,EAAE,CAAC;IAE/B,CAAC;CAEJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RuntimeApp } from './runtime-app.interface.js';
|
|
2
|
-
import {
|
|
3
|
-
export declare function bootstrapRuntime(apps: RuntimeApp[],
|
|
2
|
+
import { Runtime } from './Runtime.js';
|
|
3
|
+
export declare function bootstrapRuntime(apps: RuntimeApp[], runtime: Runtime): void;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { RuntimeEventBus } from '../events/runtime-event-bus.js';
|
|
2
1
|
import { createRuntimeContext } from './create-runtime-context.js';
|
|
3
|
-
export function bootstrapRuntime(apps,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const events = config.events ?? new RuntimeEventBus();
|
|
8
|
-
apps.forEach((app) => {
|
|
9
|
-
console.log('[BOOTSTRAP AGENTS]', config.agents);
|
|
10
|
-
const context = createRuntimeContext(app, {
|
|
11
|
-
...config,
|
|
12
|
-
events,
|
|
13
|
-
//flow: config.flow ?? new Flow1(),
|
|
14
|
-
});
|
|
15
|
-
app.register(context);
|
|
16
|
-
});
|
|
2
|
+
export function bootstrapRuntime(apps, runtime) {
|
|
3
|
+
for (const app of apps) {
|
|
4
|
+
app.register(createRuntimeContext(runtime));
|
|
5
|
+
}
|
|
17
6
|
}
|
|
7
|
+
// export function bootstrapRuntime(apps: RuntimeApp[], runtime: Runtime) {
|
|
8
|
+
// //
|
|
9
|
+
// // SINGLE SHARED RUNTIME EVENT BUS
|
|
10
|
+
// //
|
|
11
|
+
// const events = runtime.events ?? new RuntimeEventBus();
|
|
12
|
+
// apps.forEach((app) => {
|
|
13
|
+
// console.log('[BOOTSTRAP AGENTS]', runtime.agents);
|
|
14
|
+
// const context = createRuntimeContext(app, {
|
|
15
|
+
// ...runtime,
|
|
16
|
+
// events,
|
|
17
|
+
// //flow: config.flow ?? new Flow1(),
|
|
18
|
+
// });
|
|
19
|
+
// app.register(context);
|
|
20
|
+
// });
|
|
21
|
+
// }
|
|
18
22
|
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/core/runtime/bootstrap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/core/runtime/bootstrap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AASnE,MAAM,UAAU,gBAAgB,CAC5B,IAAkB,EAClB,OAAgB;IAEhB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QAErB,GAAG,CAAC,QAAQ,CACR,oBAAoB,CAAC,OAAO,CAAC,CAChC,CAAC;IACN,CAAC;AACL,CAAC;AACD,2EAA2E;AAC3E,OAAO;AACP,uCAAuC;AACvC,OAAO;AACP,4DAA4D;AAE5D,4BAA4B;AAC5B,yDAAyD;AAEzD,kDAAkD;AAClD,oBAAoB;AACpB,gBAAgB;AAChB,4CAA4C;AAC5C,UAAU;AAEV,6BAA6B;AAC7B,QAAQ;AACR,IAAI"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { RuntimeContext } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function createRuntimeContext(_app: RuntimeApp, config: RuntimeConfig): RuntimeContext;
|
|
1
|
+
import { RuntimeContext } from "./runtime-context.interface.js";
|
|
2
|
+
import { Runtime } from "./Runtime.js";
|
|
3
|
+
export declare function createRuntimeContext(runtime: Runtime): RuntimeContext;
|
|
@@ -1,29 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
import { ServiceManager } from '../service/service.manager.js';
|
|
3
|
-
import { ProviderManager } from '../provider/provider.manager.js';
|
|
4
|
-
import { ExecutionManager } from './execution/execution-manager.js';
|
|
5
|
-
import { AgentManager } from '../agent/agent-manager.js';
|
|
6
|
-
export function createRuntimeContext(_app, config) {
|
|
7
|
-
const db = config.db ? config.db : new InMemoryDB();
|
|
8
|
-
const providerManager = new ProviderManager(config.providers ?? []);
|
|
9
|
-
const serviceManager = new ServiceManager(config.services ?? []);
|
|
10
|
-
const agentManager = new AgentManager(config.agents ?? []);
|
|
11
|
-
console.log('[CONTEXT AGENTS]', config.agents);
|
|
12
|
-
console.log('[AGENT MANAGER]', agentManager.getAll());
|
|
1
|
+
export function createRuntimeContext(runtime) {
|
|
13
2
|
return {
|
|
14
|
-
apiKey:
|
|
15
|
-
db,
|
|
3
|
+
apiKey: runtime.apiKey,
|
|
4
|
+
db: runtime.db,
|
|
16
5
|
state: {},
|
|
17
|
-
protocol:
|
|
18
|
-
agents:
|
|
19
|
-
providers:
|
|
20
|
-
services:
|
|
21
|
-
events:
|
|
22
|
-
execution:
|
|
6
|
+
protocol: runtime.protocol,
|
|
7
|
+
agents: runtime.agents,
|
|
8
|
+
providers: runtime.providers,
|
|
9
|
+
services: runtime.services,
|
|
10
|
+
events: runtime.events,
|
|
11
|
+
execution: runtime.execution,
|
|
23
12
|
prompt(route, handler) {
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
//flow: config.flow,
|
|
13
|
+
runtime.protocol.addMethod(route, handler);
|
|
14
|
+
}
|
|
27
15
|
};
|
|
28
16
|
}
|
|
17
|
+
// import { InMemoryDB } from '../storage/in-memory.db.js';
|
|
18
|
+
// import { RuntimeContext } from './runtime-context.interface.js';
|
|
19
|
+
// import { RuntimeApp } from './runtime-app.interface.js';
|
|
20
|
+
// import { RuntimeOptions } from './runtime-options.interface.js';
|
|
21
|
+
// import { ServiceManager } from '../service/service.manager.js';
|
|
22
|
+
// import { ProviderManager } from '../provider/provider.manager.js';
|
|
23
|
+
// import { ExecutionManager } from './execution/execution-manager.js';
|
|
24
|
+
// import { AgentManager } from '../agent/agent-manager.js';
|
|
25
|
+
// import { Runtime } from './Runtime.js';
|
|
26
|
+
// export function createRuntimeContext(
|
|
27
|
+
// runtime:Runtime
|
|
28
|
+
// ): RuntimeContext {
|
|
29
|
+
// // const db = config.db ? config.db : new InMemoryDB();
|
|
30
|
+
// // const providerManager = new ProviderManager(config.providers ?? []);
|
|
31
|
+
// // const serviceManager = new ServiceManager(config.services ?? []);
|
|
32
|
+
// // const agentManager = new AgentManager(config.agents ?? []);
|
|
33
|
+
// // console.log('[CONTEXT AGENTS]', config.agents);
|
|
34
|
+
// // console.log('[AGENT MANAGER]', agentManager.getAll());
|
|
35
|
+
// return {
|
|
36
|
+
// db: runtime.db,
|
|
37
|
+
// protocol: runtime.protocol,
|
|
38
|
+
// agents: runtime.agents,
|
|
39
|
+
// providers: runtime.providers,
|
|
40
|
+
// services: runtime.services,
|
|
41
|
+
// events: runtime.events,
|
|
42
|
+
// execution: runtime.execution,
|
|
43
|
+
// state: {},
|
|
44
|
+
// // prompt(...) {
|
|
45
|
+
// // runtime.protocol.addMethod(...);
|
|
46
|
+
// // }
|
|
47
|
+
// }
|
|
48
|
+
// return {
|
|
49
|
+
// apiKey: config?.apiKey,
|
|
50
|
+
// db,
|
|
51
|
+
// state: {},
|
|
52
|
+
// protocol: config.protocol,
|
|
53
|
+
// agents: agentManager,
|
|
54
|
+
// providers: providerManager,
|
|
55
|
+
// services: serviceManager,
|
|
56
|
+
// events: config.events!, //ts can't fully infer this, but im ensure it's set in bootstrapRuntime
|
|
57
|
+
// execution: new ExecutionManager(),
|
|
58
|
+
// prompt(route: string, handler: Function) {
|
|
59
|
+
// config.protocol?.addMethod(route, handler);
|
|
60
|
+
// },
|
|
61
|
+
// //flow: config.flow,
|
|
62
|
+
// };
|
|
63
|
+
//}
|
|
29
64
|
//# sourceMappingURL=create-runtime-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-runtime-context.js","sourceRoot":"","sources":["../../../src/core/runtime/create-runtime-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-runtime-context.js","sourceRoot":"","sources":["../../../src/core/runtime/create-runtime-context.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,oBAAoB,CAChC,OAAgB;IAGhB,OAAO;QAEH,MAAM,EAAE,OAAO,CAAC,MAAM;QAEtB,EAAE,EAAE,OAAO,CAAC,EAAE;QAEd,KAAK,EAAE,EAAE;QAET,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAE1B,MAAM,EAAE,OAAO,CAAC,MAAM;QAEtB,SAAS,EAAE,OAAO,CAAC,SAAS;QAE5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAE1B,MAAM,EAAE,OAAO,CAAC,MAAM;QAEtB,SAAS,EAAE,OAAO,CAAC,SAAS;QAE5B,MAAM,CAAC,KAAK,EAAE,OAAO;YAEjB,OAAO,CAAC,QAAQ,CAAC,SAAS,CACtB,KAAK,EACL,OAAO,CACV,CAAC;QAEN,CAAC;KAEJ,CAAC;AAEN,CAAC;AACD,2DAA2D;AAE3D,mEAAmE;AAEnE,2DAA2D;AAE3D,mEAAmE;AAEnE,kEAAkE;AAElE,qEAAqE;AAErE,uEAAuE;AAEvE,4DAA4D;AAC5D,0CAA0C;AAE1C,wCAAwC;AACxC,oBAAoB;AACpB,sBAAsB;AACtB,4DAA4D;AAE5D,4EAA4E;AAE5E,yEAAyE;AAEzE,mEAAmE;AAEnE,uDAAuD;AAEvD,8DAA8D;AAE9D,aAAa;AAEb,sBAAsB;AAEtB,kCAAkC;AAElC,8BAA8B;AAE9B,oCAAoC;AAEpC,kCAAkC;AAElC,8BAA8B;AAE9B,oCAAoC;AAEpC,iBAAiB;AAEjB,uBAAuB;AAEvB,8CAA8C;AAE9C,WAAW;AAEX,IAAI;AAEF,WAAW;AACX,4BAA4B;AAE5B,QAAQ;AAER,eAAe;AAEf,+BAA+B;AAE/B,0BAA0B;AAE1B,gCAAgC;AAEhC,8BAA8B;AAE9B,oGAAoG;AAEpG,uCAAuC;AAEvC,+CAA+C;AAC/C,kDAAkD;AAClD,OAAO;AAEP,yBAAyB;AACzB,KAAK;AACP,GAAG"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CreateRuntimeConfig } from './create-runtime-config.interface.js';
|
|
2
|
-
import {
|
|
3
|
-
export declare function createRuntime(config: CreateRuntimeConfig):
|
|
2
|
+
import { Runtime } from './Runtime.js';
|
|
3
|
+
export declare function createRuntime(config: CreateRuntimeConfig): Runtime;
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import { randomUUID } from 'crypto';
|
|
2
2
|
import { initializeRuntimeCapabilities } from '../init/initialize-runtime-capabilities.js';
|
|
3
3
|
import { normalizeRuntimeConfig } from './normalize-runtime-config.js';
|
|
4
|
+
import { Runtime } from './Runtime.js';
|
|
4
5
|
export function createRuntime(config) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const options = normalizeRuntimeConfig(config);
|
|
7
|
+
const runtime = new Runtime(options);
|
|
8
|
+
//todo: initializeRuntimeCapabilities ( runtime)
|
|
9
|
+
initializeRuntimeCapabilities(options);
|
|
10
|
+
runtime.transport.onMessage(async (clientId, payload) => {
|
|
8
11
|
//
|
|
9
12
|
// Runtime ingress event
|
|
10
13
|
//
|
|
11
|
-
|
|
14
|
+
runtime.events?.emit({
|
|
12
15
|
id: randomUUID(),
|
|
13
16
|
type: 'runtime.message.received',
|
|
14
17
|
timestamp: Date.now(),
|
|
15
18
|
source: 'transport',
|
|
16
19
|
payload,
|
|
17
20
|
});
|
|
18
|
-
const response = await
|
|
21
|
+
const response = await runtime.protocol.receive(payload);
|
|
19
22
|
//
|
|
20
23
|
// Push-based transports
|
|
21
24
|
// (WebSocket, MQTT, TCP)
|
|
22
25
|
//
|
|
23
26
|
if (response !== undefined) {
|
|
24
|
-
await
|
|
27
|
+
await runtime.transport.send(clientId, response);
|
|
25
28
|
}
|
|
26
29
|
//
|
|
27
30
|
// Runtime response event
|
|
28
31
|
//
|
|
29
|
-
|
|
32
|
+
runtime.events?.emit({
|
|
30
33
|
id: randomUUID(),
|
|
31
34
|
type: 'runtime.message.completed',
|
|
32
35
|
timestamp: Date.now(),
|
|
@@ -39,6 +42,6 @@ export function createRuntime(config) {
|
|
|
39
42
|
//
|
|
40
43
|
return response;
|
|
41
44
|
});
|
|
42
|
-
return
|
|
45
|
+
return runtime;
|
|
43
46
|
}
|
|
44
47
|
//# sourceMappingURL=create-runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-runtime.js","sourceRoot":"","sources":["../../../src/core/runtime/create-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAI3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"create-runtime.js","sourceRoot":"","sources":["../../../src/core/runtime/create-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAI3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,UAAU,aAAa,CAAC,MAA2B;IAEvD,MAAM,OAAO,GAAmB,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAE/D,MAAM,OAAO,GACX,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAErB,gDAAgD;IAClD,6BAA6B,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;QACtD,EAAE;QACF,wBAAwB;QACxB,EAAE;QACF,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;YACnB,EAAE,EAAE,UAAU,EAAE;YAEhB,IAAI,EAAE,0BAA0B;YAEhC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YAErB,MAAM,EAAE,WAAW;YAEnB,OAAO;SACR,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEzD,EAAE;QACF,wBAAwB;QACxB,yBAAyB;QACzB,EAAE;QACF,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC;QAED,EAAE;QACF,yBAAyB;QACzB,EAAE;QACF,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;YACnB,EAAE,EAAE,UAAU,EAAE;YAEhB,IAAI,EAAE,2BAA2B;YAEjC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YAErB,MAAM,EAAE,SAAS;YAEjB,OAAO,EAAE,QAAQ;SAClB,CAAC,CAAC;QAEH,EAAE;QACF,8BAA8B;QAC9B,4DAA4D;QAC5D,EAAE;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CreateRuntimeConfig } from './create-runtime-config.interface.js';
|
|
2
|
-
import {
|
|
3
|
-
export declare function normalizeRuntimeConfig(config: CreateRuntimeConfig):
|
|
2
|
+
import { RuntimeOptions } from './runtime-options.interface.js';
|
|
3
|
+
export declare function normalizeRuntimeConfig(config: CreateRuntimeConfig): RuntimeOptions;
|
|
@@ -5,7 +5,7 @@ import { Protocol } from '../protocol/protocol.interface.js';
|
|
|
5
5
|
import { ProviderConfig } from '../provider/provider.config.interface.js';
|
|
6
6
|
import { ServiceConfig } from '../service/service-config.interface.js';
|
|
7
7
|
import { Transport } from '../transport/transport.interface.js';
|
|
8
|
-
export interface
|
|
8
|
+
export interface RuntimeOptions {
|
|
9
9
|
apiKey: string;
|
|
10
10
|
transport: Transport;
|
|
11
11
|
protocol: Protocol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-options.interface.js","sourceRoot":"","sources":["../../../src/core/runtime/runtime-options.interface.ts"],"names":[],"mappings":""}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from '../core/runtime/create-runtime.js';
|
|
2
|
-
export * from '../core/runtime/runtime-
|
|
2
|
+
export * from '../core/runtime/runtime-options.interface.js';
|
|
3
3
|
export * from '../core/runtime/runtime-context.interface.js';
|
|
4
4
|
export * from '../core/runtime/runtime-app.interface.js';
|
|
5
5
|
export * from '../core/service/service-config.interface.js';
|
package/dist/runtime/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from '../core/runtime/create-runtime.js';
|
|
2
|
-
export * from '../core/runtime/runtime-
|
|
2
|
+
export * from '../core/runtime/runtime-options.interface.js';
|
|
3
3
|
export * from '../core/runtime/runtime-context.interface.js';
|
|
4
4
|
export * from '../core/runtime/runtime-app.interface.js';
|
|
5
5
|
export * from '../core/service/service-config.interface.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAElD,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAElD,cAAc,8CAA8C,CAAC;AAE7D,cAAc,8CAA8C,CAAC;AAE7D,cAAc,0CAA0C,CAAC;AAEzD,cAAc,6CAA6C,CAAC;AAE5D,cAAc,+CAA+C,CAAC;AAE9D,cAAc,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-config.interface.js","sourceRoot":"","sources":["../../../src/core/runtime/runtime-config.interface.ts"],"names":[],"mappings":""}
|