@ultrst-armada/kloks 1.19.0 → 1.21.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/.krusbl-release-attestation.json +3 -3
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/package.json +6 -1
- package/packages/aiko/dist/index.d.ts +105 -0
- package/packages/aiko/dist/index.js +84 -0
- package/packages/aiko/kloks.manifest.json +32 -0
- package/packages/aiko/package.json +14 -0
- package/packages/backend/dist/ai-keys/index.d.ts +2 -1
- package/packages/backend/dist/ai-keys/index.js +1 -1
- package/packages/backend/dist/ai-models/index.js +2 -2
- package/packages/backend/dist/ai-routing/index.js +3 -3
- package/packages/backend/dist/{chunk-RSKFM7AC.js → chunk-KPLQLZHB.js} +7 -4
- package/packages/backend/dist/{chunk-4WUVDLIQ.js → chunk-LMWXONZG.js} +1 -1
- package/packages/backend/dist/{chunk-F7JDIU2C.js → chunk-P7H6TIEA.js} +3 -0
- package/packages/backend/dist/{chunk-UYXROZPP.js → chunk-PT6J6UEU.js} +2 -2
- package/packages/backend/dist/index.d.ts +1 -1
- package/packages/backend/dist/index.js +4 -4
- package/packages/backend/dist/krnl-ai-services.d.ts +12 -2
- package/packages/backend/dist/krnl-ai-services.js +4 -4
- package/packages/backend/dist/{types-B0aSwTAt.d.ts → types-NITEaxAh.d.ts} +1 -0
- package/packages/fod/dist/index.d.ts +2 -2
- package/packages/fod/dist/index.js +14 -7
- package/packages/state-graph/dist/index.js +9 -9
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"packageName": "@ultrst-armada/kloks",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"sourceCommit": "
|
|
4
|
+
"version": "1.21.1",
|
|
5
|
+
"sourceCommit": "00c11733eb2e2db55059254b449ef2fd91f773bf",
|
|
6
6
|
"releaseWorkflow": "npm Release",
|
|
7
|
-
"workflowRunId": "
|
|
7
|
+
"workflowRunId": "41029589624"
|
|
8
8
|
}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -5,4 +5,5 @@ export * from './packages/services/dist/index.js';
|
|
|
5
5
|
export * from './packages/backend/dist/index.js';
|
|
6
6
|
export * from './packages/orchestrations/dist/index.js';
|
|
7
7
|
export * from './packages/contracts/dist/index.js';
|
|
8
|
-
export * from './packages/fod/dist/index';
|
|
8
|
+
export * from './packages/fod/dist/index.js';
|
|
9
|
+
export * from './packages/aiko/dist/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultrst-armada/kloks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -149,6 +149,11 @@
|
|
|
149
149
|
"types": "./packages/fod/dist/index.d.ts",
|
|
150
150
|
"import": "./packages/fod/dist/index.js",
|
|
151
151
|
"default": "./packages/fod/dist/index.js"
|
|
152
|
+
},
|
|
153
|
+
"./aiko": {
|
|
154
|
+
"types": "./packages/aiko/dist/index.d.ts",
|
|
155
|
+
"import": "./packages/aiko/dist/index.js",
|
|
156
|
+
"default": "./packages/aiko/dist/index.js"
|
|
152
157
|
}
|
|
153
158
|
},
|
|
154
159
|
"scripts": {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
type AikoSourceKind = 'endpoint' | 'fod-flow' | 'gutts-api' | 'custom';
|
|
2
|
+
interface AikoIntelligenceSpec {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
}
|
|
5
|
+
interface AikoTool {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
inputSchema?: unknown;
|
|
10
|
+
execute: (input: unknown) => Promise<unknown>;
|
|
11
|
+
sourceKind: AikoSourceKind;
|
|
12
|
+
sourceId: string;
|
|
13
|
+
}
|
|
14
|
+
interface AikoAgentDefinition {
|
|
15
|
+
schemaVersion: '1.0.0';
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
agentType: 'TOOL' | 'ENDPOINT' | 'AIKO';
|
|
20
|
+
tool: AikoTool;
|
|
21
|
+
intelligenceSpec: AikoIntelligenceSpec;
|
|
22
|
+
intelligenceSpecId?: string;
|
|
23
|
+
sourceKind: AikoSourceKind;
|
|
24
|
+
sourceId: string;
|
|
25
|
+
allowedToolIds?: string[];
|
|
26
|
+
custom?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface AikoCapability {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
sourceKind: AikoSourceKind;
|
|
33
|
+
sourceId: string;
|
|
34
|
+
inputSchema?: unknown;
|
|
35
|
+
execute: (input: unknown) => Promise<unknown>;
|
|
36
|
+
}
|
|
37
|
+
interface AikoKey {
|
|
38
|
+
id: string;
|
|
39
|
+
providerId: string;
|
|
40
|
+
label: string;
|
|
41
|
+
status?: string;
|
|
42
|
+
isActive?: boolean;
|
|
43
|
+
emailGroup?: string;
|
|
44
|
+
expiresAt?: string | null;
|
|
45
|
+
}
|
|
46
|
+
interface AikoIntelligenceResolver {
|
|
47
|
+
resolve(specId?: string, context?: {
|
|
48
|
+
agent?: AikoAgentDefinition;
|
|
49
|
+
tool?: AikoTool;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
spec: AikoIntelligenceSpec;
|
|
52
|
+
specId?: string;
|
|
53
|
+
}> | {
|
|
54
|
+
spec: AikoIntelligenceSpec;
|
|
55
|
+
specId?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
interface AikoKeyRuntime {
|
|
59
|
+
listKeys(): Promise<AikoKey[]>;
|
|
60
|
+
getActiveKey(providerId: string): Promise<AikoKey | null>;
|
|
61
|
+
rotateKey(providerId: string): Promise<AikoKey | null>;
|
|
62
|
+
addKey?(input: {
|
|
63
|
+
providerId: string;
|
|
64
|
+
label: string;
|
|
65
|
+
key: string;
|
|
66
|
+
emailGroup?: string;
|
|
67
|
+
}): Promise<AikoKey>;
|
|
68
|
+
syncFromAikoEngine(): Promise<{
|
|
69
|
+
synced: number;
|
|
70
|
+
message?: string;
|
|
71
|
+
}>;
|
|
72
|
+
}
|
|
73
|
+
interface AikoRuntimeOptions {
|
|
74
|
+
customAgents?: AikoAgentDefinition[];
|
|
75
|
+
capabilities: (() => Promise<AikoCapability[]> | AikoCapability[]) | AikoCapability[];
|
|
76
|
+
resolver: AikoIntelligenceResolver;
|
|
77
|
+
resolveNaturalLanguage?: (agent: AikoAgentDefinition, input: string) => Promise<unknown>;
|
|
78
|
+
keys: AikoKeyRuntime;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
declare class AikoRuntime {
|
|
82
|
+
private readonly options;
|
|
83
|
+
private readonly agents;
|
|
84
|
+
constructor(options: AikoRuntimeOptions);
|
|
85
|
+
listCapabilities(): Promise<AikoCapability[]>;
|
|
86
|
+
refreshAgents(): Promise<AikoAgentDefinition[]>;
|
|
87
|
+
listAgents(): Promise<AikoAgentDefinition[]>;
|
|
88
|
+
executeAgent(agentId: string, input: unknown): Promise<unknown>;
|
|
89
|
+
createCustomAgent(name: string, capabilityIds: string[], specId?: string): Promise<AikoAgentDefinition>;
|
|
90
|
+
listKeys(): Promise<AikoKey[]>;
|
|
91
|
+
getActiveKey(providerId: string): Promise<AikoKey | null>;
|
|
92
|
+
rotateKey(providerId: string): Promise<AikoKey | null>;
|
|
93
|
+
syncFromAikoEngine(): Promise<{
|
|
94
|
+
synced: number;
|
|
95
|
+
message?: string;
|
|
96
|
+
}>;
|
|
97
|
+
addKey(input: {
|
|
98
|
+
providerId: string;
|
|
99
|
+
label: string;
|
|
100
|
+
key: string;
|
|
101
|
+
emailGroup?: string;
|
|
102
|
+
}): Promise<AikoKey>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { type AikoAgentDefinition, type AikoCapability, type AikoIntelligenceResolver, type AikoIntelligenceSpec, type AikoKey, type AikoKeyRuntime, AikoRuntime, type AikoRuntimeOptions, type AikoSourceKind, type AikoTool };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// src/runtime.ts
|
|
2
|
+
var AikoRuntime = class {
|
|
3
|
+
options;
|
|
4
|
+
agents = /* @__PURE__ */ new Map();
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
for (const agent of options.customAgents ?? []) this.agents.set(agent.id, agent);
|
|
8
|
+
}
|
|
9
|
+
async listCapabilities() {
|
|
10
|
+
const caps = this.options.capabilities;
|
|
11
|
+
return typeof caps === "function" ? await caps() : caps;
|
|
12
|
+
}
|
|
13
|
+
async refreshAgents() {
|
|
14
|
+
const capabilities = await this.listCapabilities();
|
|
15
|
+
const next = /* @__PURE__ */ new Map();
|
|
16
|
+
for (const agent of this.agents.values()) {
|
|
17
|
+
if (agent.custom || agent.sourceKind === "custom") next.set(agent.id, agent);
|
|
18
|
+
}
|
|
19
|
+
for (const capability of capabilities) {
|
|
20
|
+
const tool = { id: capability.id, name: capability.name, description: capability.description, inputSchema: capability.inputSchema, execute: capability.execute, sourceKind: capability.sourceKind, sourceId: capability.sourceId };
|
|
21
|
+
const resolved = await this.options.resolver.resolve(void 0, { tool });
|
|
22
|
+
const agent = {
|
|
23
|
+
schemaVersion: "1.0.0",
|
|
24
|
+
id: "aiko-" + capability.sourceKind + "-" + capability.sourceId,
|
|
25
|
+
name: capability.name + " Agent",
|
|
26
|
+
description: capability.description ?? "Aiko agent for " + capability.name,
|
|
27
|
+
agentType: capability.sourceKind === "endpoint" ? "ENDPOINT" : "TOOL",
|
|
28
|
+
tool,
|
|
29
|
+
intelligenceSpec: resolved.spec,
|
|
30
|
+
intelligenceSpecId: resolved.specId,
|
|
31
|
+
sourceKind: capability.sourceKind,
|
|
32
|
+
sourceId: capability.sourceId
|
|
33
|
+
};
|
|
34
|
+
next.set(agent.id, agent);
|
|
35
|
+
}
|
|
36
|
+
this.agents.clear();
|
|
37
|
+
for (const agent of next.values()) this.agents.set(agent.id, agent);
|
|
38
|
+
return [...this.agents.values()];
|
|
39
|
+
}
|
|
40
|
+
async listAgents() {
|
|
41
|
+
return this.agents.size ? [...this.agents.values()] : this.refreshAgents();
|
|
42
|
+
}
|
|
43
|
+
async executeAgent(agentId, input) {
|
|
44
|
+
const agent = this.agents.get(agentId) ?? (await this.refreshAgents()).find((item) => item.id === agentId);
|
|
45
|
+
if (!agent) throw new Error("Aiko agent not found: " + agentId);
|
|
46
|
+
const resolvedInput = typeof input === "string" && this.options.resolveNaturalLanguage ? await this.options.resolveNaturalLanguage(agent, input) : input;
|
|
47
|
+
return agent.tool.execute(resolvedInput);
|
|
48
|
+
}
|
|
49
|
+
async createCustomAgent(name, capabilityIds, specId) {
|
|
50
|
+
const capabilities = await this.listCapabilities();
|
|
51
|
+
const allowed = capabilities.filter((item) => capabilityIds.includes(item.id));
|
|
52
|
+
if (allowed.length === 0) throw new Error("A custom Aiko agent requires at least one permitted capability.");
|
|
53
|
+
const resolved = await this.options.resolver.resolve(specId, {});
|
|
54
|
+
const tool = { id: "custom-" + name, name, description: "Custom Aiko capability set", execute: async (input) => {
|
|
55
|
+
const request = input;
|
|
56
|
+
if (!request?.toolId || !capabilityIds.includes(request.toolId)) throw new Error("Capability is not permitted for this custom agent.");
|
|
57
|
+
const capability = allowed.find((item) => item.id === request.toolId);
|
|
58
|
+
if (!capability) throw new Error("Capability not found.");
|
|
59
|
+
return capability.execute(request.input);
|
|
60
|
+
}, sourceKind: "custom", sourceId: name };
|
|
61
|
+
const agent = { schemaVersion: "1.0.0", id: "aiko-custom-" + name.toLowerCase().replace(/\s+/g, "-"), name, description: "Custom Aiko agent", agentType: "AIKO", tool, intelligenceSpec: resolved.spec, intelligenceSpecId: resolved.specId, sourceKind: "custom", sourceId: name, allowedToolIds: capabilityIds, custom: true };
|
|
62
|
+
this.agents.set(agent.id, agent);
|
|
63
|
+
return agent;
|
|
64
|
+
}
|
|
65
|
+
listKeys() {
|
|
66
|
+
return this.options.keys.listKeys();
|
|
67
|
+
}
|
|
68
|
+
getActiveKey(providerId) {
|
|
69
|
+
return this.options.keys.getActiveKey(providerId);
|
|
70
|
+
}
|
|
71
|
+
rotateKey(providerId) {
|
|
72
|
+
return this.options.keys.rotateKey(providerId);
|
|
73
|
+
}
|
|
74
|
+
syncFromAikoEngine() {
|
|
75
|
+
return this.options.keys.syncFromAikoEngine();
|
|
76
|
+
}
|
|
77
|
+
addKey(input) {
|
|
78
|
+
if (!this.options.keys.addKey) throw new Error("Local Aiko key storage is unavailable.");
|
|
79
|
+
return this.options.keys.addKey(input);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export {
|
|
83
|
+
AikoRuntime
|
|
84
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://skipo.dev/schemas/kloks-manifest.v1.json",
|
|
3
|
+
"package": "@kloks/aiko",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"services": [
|
|
6
|
+
{
|
|
7
|
+
"id": "aiko",
|
|
8
|
+
"name": "Aiko Application Module",
|
|
9
|
+
"version": "1.0.0",
|
|
10
|
+
"description": "Embedded Aiko agent runtime, intelligence resolution, and API key synchronization module for Skipo applications.",
|
|
11
|
+
"backend": {
|
|
12
|
+
"package": "@ultrst-armada/kloks",
|
|
13
|
+
"subpath": "aiko",
|
|
14
|
+
"export": "AikoRuntime",
|
|
15
|
+
"facade": "AikoRuntime"
|
|
16
|
+
},
|
|
17
|
+
"modes": [
|
|
18
|
+
"backend",
|
|
19
|
+
"fullstack"
|
|
20
|
+
],
|
|
21
|
+
"targets": {
|
|
22
|
+
"backend": [
|
|
23
|
+
"BackendFacade.services"
|
|
24
|
+
],
|
|
25
|
+
"frontend": [
|
|
26
|
+
"Main.tabs.aiko"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"dependencies": []
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name":"@kloks/aiko",
|
|
3
|
+
"version":"1.0.0",
|
|
4
|
+
"description":"Embedded Aiko application module runtime for Skipo applications.",
|
|
5
|
+
"type":"module",
|
|
6
|
+
"private":false,
|
|
7
|
+
"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},
|
|
8
|
+
"main":"./dist/index.js",
|
|
9
|
+
"types":"./dist/index.d.ts",
|
|
10
|
+
"module":"./dist/index.js",
|
|
11
|
+
"exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts","default":"./dist/index.js"}},
|
|
12
|
+
"scripts":{"build":"tsup src/index.ts --format esm --dts --clean","typecheck":"tsc --noEmit","test":"vitest run","clean":"rm -rf dist"},
|
|
13
|
+
"devDependencies":{"tsup":"^8.4.0","typescript":"^5.7.3","vitest":"^3.1.0"}
|
|
14
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as KeyValidationResult, A as ApiKeyEntry, R as RotationStrategy, K as KeyModelUsageStats } from '../types-
|
|
1
|
+
import { a as KeyValidationResult, A as ApiKeyEntry, R as RotationStrategy, K as KeyModelUsageStats } from '../types-NITEaxAh.js';
|
|
2
2
|
import { P as ProviderId } from '../types-Di4ZAQYA.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -46,6 +46,7 @@ declare class KeyStoreService {
|
|
|
46
46
|
peekNextKey(providerId: ProviderId, _modelId?: string): ApiKeyEntry | null;
|
|
47
47
|
getNextKey(providerId: ProviderId, modelId?: string): ApiKeyEntry | null;
|
|
48
48
|
selectNextKey(providerId: ProviderId, _modelId?: string): ApiKeyEntry | undefined;
|
|
49
|
+
rotateKey(providerId: ProviderId): ApiKeyEntry | null;
|
|
49
50
|
updateKeyLabel(id: string, label: string): ApiKeyEntry | undefined;
|
|
50
51
|
deleteKey(id: string): boolean;
|
|
51
52
|
resetKeyProbabilities(id: string): ApiKeyEntry | undefined;
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
endpointRefresher,
|
|
8
8
|
modelCatalog,
|
|
9
9
|
modelHealthService
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-LMWXONZG.js";
|
|
11
|
+
import "../chunk-P7H6TIEA.js";
|
|
12
12
|
import "../chunk-MAMK4GDH.js";
|
|
13
13
|
import "../chunk-JSQZAFBU.js";
|
|
14
14
|
export {
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
failoverExecutionEngine,
|
|
7
7
|
healthCheckService,
|
|
8
8
|
metricsLogger
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-PT6J6UEU.js";
|
|
10
|
+
import "../chunk-LMWXONZG.js";
|
|
11
|
+
import "../chunk-P7H6TIEA.js";
|
|
12
12
|
import "../chunk-SLR6SIEU.js";
|
|
13
13
|
import "../chunk-MAMK4GDH.js";
|
|
14
14
|
import "../chunk-JSQZAFBU.js";
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
} from "./chunk-GCTQY24J.js";
|
|
11
11
|
import {
|
|
12
12
|
failoverExecutionEngine
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PT6J6UEU.js";
|
|
14
14
|
import {
|
|
15
15
|
modelCatalog
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-LMWXONZG.js";
|
|
17
17
|
import {
|
|
18
18
|
keyStore
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-P7H6TIEA.js";
|
|
20
20
|
import {
|
|
21
21
|
aiProviderService
|
|
22
22
|
} from "./chunk-SLR6SIEU.js";
|
|
@@ -175,8 +175,11 @@ var AIKeyServiceFacade = {
|
|
|
175
175
|
deployment: "local",
|
|
176
176
|
getKeys: (providerId, modelId) => keyStore.getKeys(providerId, modelId),
|
|
177
177
|
getStrategy: () => keyStore.getStrategy(),
|
|
178
|
-
getUsageStats: (keyId, modelId) => keyStore.getUsageStats(keyId, modelId),
|
|
179
178
|
addKey: (input) => keyStore.addKey(input),
|
|
179
|
+
getActiveKey: (providerId) => keyStore.getActiveKey(providerId),
|
|
180
|
+
rotateKey: (providerId) => keyStore.rotateKey(providerId),
|
|
181
|
+
importKeys: (payload) => keyStore.importKeys(payload),
|
|
182
|
+
exportKeysStructured: () => keyStore.exportKeysStructured(),
|
|
180
183
|
definition: AIKeyServiceDefinition,
|
|
181
184
|
createInstance: () => createService(AIKeyServiceDefinition),
|
|
182
185
|
execute: async (op, input) => {
|
|
@@ -175,6 +175,9 @@ var KeyStoreService = class {
|
|
|
175
175
|
selectNextKey(providerId, _modelId) {
|
|
176
176
|
return this.getActiveKey(providerId);
|
|
177
177
|
}
|
|
178
|
+
rotateKey(providerId) {
|
|
179
|
+
return this.getNextKey(providerId);
|
|
180
|
+
}
|
|
178
181
|
updateKeyLabel(id, label) {
|
|
179
182
|
const key = this.getKey(id);
|
|
180
183
|
if (!key) return void 0;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
modelCatalog,
|
|
3
3
|
modelHealthService
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LMWXONZG.js";
|
|
5
5
|
import {
|
|
6
6
|
keyStore
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-P7H6TIEA.js";
|
|
8
8
|
import {
|
|
9
9
|
aiProviderService
|
|
10
10
|
} from "./chunk-SLR6SIEU.js";
|
|
@@ -21,7 +21,7 @@ export { DeterministicEndpointExecutor, EndpointExecutionParams, EndpointExecuti
|
|
|
21
21
|
export { M as ModelCatalogEntry, a as ModelHealthStatus } from './types-fYUdf9oB.js';
|
|
22
22
|
export { EndpointRefresher, ModelCatalogService, ModelHealthService, STATIC_MODELS_CATALOG, endpointRefresher, modelCatalog, modelHealthService } from './ai-models/index.js';
|
|
23
23
|
export { AIMetricRecord, AIRoutingStrategy, FailoverExecutionEngine, HealthCheckService, MetricsLogger, RetryPolicy, RouteCandidate, RouteExecutionResult, failoverExecutionEngine, healthCheckService, metricsLogger } from './ai-routing/index.js';
|
|
24
|
-
export { A as ApiKeyEntry, K as KeyModelUsageStats, a as KeyValidationResult, R as RotationStrategy } from './types-
|
|
24
|
+
export { A as ApiKeyEntry, K as KeyModelUsageStats, a as KeyValidationResult, R as RotationStrategy } from './types-NITEaxAh.js';
|
|
25
25
|
export { KeyStoreService, KeysStorage, keyStore, keysStorage, validateApiKey } from './ai-keys/index.js';
|
|
26
26
|
export { MCPEngine, MCPServerConfig, MCPTool, MCPToolParameter, ToolExecutionResult, ToolInputValidationResult, ToolManagerService, mcpEngine, toolManagerService, validateToolInput } from './ai-tools/index.js';
|
|
27
27
|
export { AIInferenceServiceDefinition, AIInferenceServiceFacade, AIKeyServiceDefinition, AIKeyServiceFacade, AIModelCatalogServiceDefinition, AIModelCatalogServiceFacade, AIProviderServiceDefinition, AIProviderServiceFacade, AIRoutingServiceDefinition, AIRoutingServiceFacade, AIToolServiceDefinition, AIToolServiceFacade } from './krnl-ai-services.js';
|
|
@@ -138,7 +138,7 @@ import {
|
|
|
138
138
|
AIRoutingServiceFacade,
|
|
139
139
|
AIToolServiceDefinition,
|
|
140
140
|
AIToolServiceFacade
|
|
141
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-KPLQLZHB.js";
|
|
142
142
|
import {
|
|
143
143
|
MCPEngine,
|
|
144
144
|
ToolManagerService,
|
|
@@ -279,7 +279,7 @@ import {
|
|
|
279
279
|
failoverExecutionEngine,
|
|
280
280
|
healthCheckService,
|
|
281
281
|
metricsLogger
|
|
282
|
-
} from "./chunk-
|
|
282
|
+
} from "./chunk-PT6J6UEU.js";
|
|
283
283
|
import {
|
|
284
284
|
EndpointRefresher,
|
|
285
285
|
ModelCatalogService,
|
|
@@ -288,14 +288,14 @@ import {
|
|
|
288
288
|
endpointRefresher,
|
|
289
289
|
modelCatalog,
|
|
290
290
|
modelHealthService
|
|
291
|
-
} from "./chunk-
|
|
291
|
+
} from "./chunk-LMWXONZG.js";
|
|
292
292
|
import {
|
|
293
293
|
KeyStoreService,
|
|
294
294
|
KeysStorage,
|
|
295
295
|
keyStore,
|
|
296
296
|
keysStorage,
|
|
297
297
|
validateApiKey
|
|
298
|
-
} from "./chunk-
|
|
298
|
+
} from "./chunk-P7H6TIEA.js";
|
|
299
299
|
import {
|
|
300
300
|
AIProviderService,
|
|
301
301
|
aiProviderService
|
|
@@ -2,7 +2,7 @@ import * as _ultrst_armada_krnl from '@ultrst-armada/krnl';
|
|
|
2
2
|
import { ServiceDefinition } from '@ultrst-armada/krnl';
|
|
3
3
|
import { P as ProviderId } from './types-Di4ZAQYA.js';
|
|
4
4
|
import { M as ModelCatalogEntry } from './types-fYUdf9oB.js';
|
|
5
|
-
import { A as ApiKeyEntry, R as RotationStrategy
|
|
5
|
+
import { A as ApiKeyEntry, R as RotationStrategy } from './types-NITEaxAh.js';
|
|
6
6
|
|
|
7
7
|
declare const AIProviderServiceDefinition: ServiceDefinition;
|
|
8
8
|
declare const AIProviderServiceFacade: {
|
|
@@ -68,8 +68,18 @@ declare const AIKeyServiceFacade: {
|
|
|
68
68
|
deployment: "local";
|
|
69
69
|
getKeys: (providerId?: string, modelId?: string) => ApiKeyEntry[];
|
|
70
70
|
getStrategy: () => RotationStrategy;
|
|
71
|
-
getUsageStats: (keyId?: string, modelId?: string) => KeyModelUsageStats[];
|
|
72
71
|
addKey: (input: any) => ApiKeyEntry;
|
|
72
|
+
getActiveKey: (providerId: string) => ApiKeyEntry;
|
|
73
|
+
rotateKey: (providerId: string) => ApiKeyEntry;
|
|
74
|
+
importKeys: (payload: unknown) => Promise<{
|
|
75
|
+
importedCount: number;
|
|
76
|
+
keys: ApiKeyEntry[];
|
|
77
|
+
}>;
|
|
78
|
+
exportKeysStructured: () => {
|
|
79
|
+
version: 1;
|
|
80
|
+
exportedAt: string;
|
|
81
|
+
keys: ApiKeyEntry[];
|
|
82
|
+
};
|
|
73
83
|
definition: ServiceDefinition<Record<string, unknown>, Record<string, unknown>>;
|
|
74
84
|
createInstance: () => _ultrst_armada_krnl.ServiceInstance<Record<string, unknown>, Record<string, unknown>>;
|
|
75
85
|
execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
AIRoutingServiceFacade,
|
|
12
12
|
AIToolServiceDefinition,
|
|
13
13
|
AIToolServiceFacade
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-KPLQLZHB.js";
|
|
15
15
|
import "./chunk-U4HUGPRH.js";
|
|
16
16
|
import "./chunk-TY32TUNI.js";
|
|
17
17
|
import "./chunk-GCTQY24J.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-PT6J6UEU.js";
|
|
19
|
+
import "./chunk-LMWXONZG.js";
|
|
20
|
+
import "./chunk-P7H6TIEA.js";
|
|
21
21
|
import "./chunk-SLR6SIEU.js";
|
|
22
22
|
import "./chunk-MAMK4GDH.js";
|
|
23
23
|
import "./chunk-JSQZAFBU.js";
|
|
@@ -109,7 +109,7 @@ declare class FodFlowStore {
|
|
|
109
109
|
delete(workspaceId: string, flowId: string): Promise<boolean>;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
declare function executeFodFlow(flow: FodFlow, endpoints: Map<string, FodEndpointDescriptor>, onEvent?: (event: FodExecutionEvent) => void): Promise<FodExecutionResult>;
|
|
112
|
+
declare function executeFodFlow(flow: FodFlow, endpoints: Map<string, FodEndpointDescriptor>, onEvent?: (event: FodExecutionEvent) => void, initialInput?: unknown): Promise<FodExecutionResult>;
|
|
113
113
|
|
|
114
114
|
declare class FodRuntime {
|
|
115
115
|
private readonly options;
|
|
@@ -128,7 +128,7 @@ declare class FodRuntime {
|
|
|
128
128
|
getFlow(flowId: string): Promise<FodFlow | null>;
|
|
129
129
|
saveFlow(flow: FodFlow): Promise<FodFlow>;
|
|
130
130
|
deleteFlow(flowId: string): Promise<boolean>;
|
|
131
|
-
executeFlow(flowId: string): Promise<FodExecutionResult>;
|
|
131
|
+
executeFlow(flowId: string, input?: unknown): Promise<FodExecutionResult>;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
declare function createFodServiceFacade(runtime: FodRuntime): {
|
|
@@ -108,7 +108,7 @@ var FodFlowStore = class {
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
// src/executor.ts
|
|
111
|
-
async function executeFodFlow(flow, endpoints, onEvent) {
|
|
111
|
+
async function executeFodFlow(flow, endpoints, onEvent, initialInput) {
|
|
112
112
|
const events = [];
|
|
113
113
|
const errors = [];
|
|
114
114
|
const emit = (event) => {
|
|
@@ -132,14 +132,21 @@ async function executeFodFlow(flow, endpoints, onEvent) {
|
|
|
132
132
|
remaining.delete(node.id);
|
|
133
133
|
emit({ type: "node-started", timestamp: Date.now(), flowId: flow.id, nodeId: node.id });
|
|
134
134
|
try {
|
|
135
|
-
const endpointId = String(node.data
|
|
135
|
+
const endpointId = String(node.data?.endpointId ?? node.data?.apiId ?? node.type.replace(/^(host|gutts)\//, ""));
|
|
136
136
|
const endpoint = endpoints.get(endpointId);
|
|
137
137
|
if (!endpoint) throw new Error(`No executable endpoint registered for node '${node.type}'.`);
|
|
138
138
|
const input = {};
|
|
139
|
+
if (incoming(node.id).length === 0 && initialInput !== void 0) {
|
|
140
|
+
if (typeof initialInput === "object" && initialInput !== null) {
|
|
141
|
+
Object.assign(input, initialInput);
|
|
142
|
+
} else {
|
|
143
|
+
input.input = initialInput;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
139
146
|
for (const edge of incoming(node.id)) {
|
|
140
147
|
input[String(edge.targetHandle ?? "input")] = values.get(`${edge.source}:${edge.sourceHandle ?? "result"}`);
|
|
141
148
|
}
|
|
142
|
-
const configured = node.data
|
|
149
|
+
const configured = node.data?.inputs ?? {};
|
|
143
150
|
Object.assign(input, configured);
|
|
144
151
|
const result = await endpoint.invoke(input);
|
|
145
152
|
outputs[node.id] = result;
|
|
@@ -195,10 +202,10 @@ var FodRuntime = class {
|
|
|
195
202
|
async deleteFlow(flowId) {
|
|
196
203
|
return this.flowStore.delete(this.options.workspaceId, flowId);
|
|
197
204
|
}
|
|
198
|
-
async executeFlow(flowId) {
|
|
205
|
+
async executeFlow(flowId, input) {
|
|
199
206
|
const flow = await this.getFlow(flowId);
|
|
200
207
|
if (!flow) throw new Error(`FOD flow '${flowId}' not found.`);
|
|
201
|
-
return executeFodFlow(flow, this.endpoints, this.options.onEvent);
|
|
208
|
+
return executeFodFlow(flow, this.endpoints, this.options.onEvent, input);
|
|
202
209
|
}
|
|
203
210
|
};
|
|
204
211
|
|
|
@@ -214,7 +221,7 @@ function createFodServiceFacade(runtime) {
|
|
|
214
221
|
getFlow: { id: "FodService.getFlow", name: "getFlow", inputSchema: { type: "object", properties: { flowId: { type: "string" } }, required: ["flowId"] }, outputSchema: { type: "object" }, handler: async (input) => runtime.getFlow(String(input.flowId)) },
|
|
215
222
|
saveFlow: { id: "FodService.saveFlow", name: "saveFlow", inputSchema: { type: "object" }, outputSchema: { type: "object" }, handler: async (input) => runtime.saveFlow(input.flow) },
|
|
216
223
|
deleteFlow: { id: "FodService.deleteFlow", name: "deleteFlow", inputSchema: { type: "object", properties: { flowId: { type: "string" } }, required: ["flowId"] }, outputSchema: { type: "object" }, handler: async (input) => ({ success: await runtime.deleteFlow(String(input.flowId)) }) },
|
|
217
|
-
executeFlow: { id: "FodService.executeFlow", name: "executeFlow", inputSchema: { type: "object", properties: { flowId: { type: "string" } }, required: ["flowId"] }, outputSchema: { type: "object" }, handler: async (input) => runtime.executeFlow(String(input.flowId)) }
|
|
224
|
+
executeFlow: { id: "FodService.executeFlow", name: "executeFlow", inputSchema: { type: "object", properties: { flowId: { type: "string" }, input: { type: "object" } }, required: ["flowId"] }, outputSchema: { type: "object" }, handler: async (input) => runtime.executeFlow(String(input.flowId), input.input) }
|
|
218
225
|
}
|
|
219
226
|
};
|
|
220
227
|
const service = createService(definition);
|
|
@@ -233,7 +240,7 @@ function createFodServiceFacadeForWorkspace(buildRuntime) {
|
|
|
233
240
|
getFlow: { id: "FodService.getFlow", name: "getFlow", inputSchema: { type: "object", properties: { workspaceId: { type: "string" }, flowId: { type: "string" } }, required: ["workspaceId", "flowId"] }, outputSchema: { type: "object" }, handler: async (input) => buildRuntime(String(input.workspaceId)).getFlow(String(input.flowId)) },
|
|
234
241
|
saveFlow: { id: "FodService.saveFlow", name: "saveFlow", inputSchema: { type: "object", properties: { workspaceId: { type: "string" }, flow: { type: "object" } }, required: ["workspaceId", "flow"] }, outputSchema: { type: "object" }, handler: async (input) => buildRuntime(String(input.workspaceId)).saveFlow(input.flow) },
|
|
235
242
|
deleteFlow: { id: "FodService.deleteFlow", name: "deleteFlow", inputSchema: { type: "object", properties: { workspaceId: { type: "string" }, flowId: { type: "string" } }, required: ["workspaceId", "flowId"] }, outputSchema: { type: "object" }, handler: async (input) => ({ success: await buildRuntime(String(input.workspaceId)).deleteFlow(String(input.flowId)) }) },
|
|
236
|
-
executeFlow: { id: "FodService.executeFlow", name: "executeFlow", inputSchema: { type: "object", properties: { workspaceId: { type: "string" }, flowId: { type: "string" } }, required: ["workspaceId", "flowId"] }, outputSchema: { type: "object" }, handler: async (input) => buildRuntime(String(input.workspaceId)).executeFlow(String(input.flowId)) }
|
|
243
|
+
executeFlow: { id: "FodService.executeFlow", name: "executeFlow", inputSchema: { type: "object", properties: { workspaceId: { type: "string" }, flowId: { type: "string" }, input: { type: "object" } }, required: ["workspaceId", "flowId"] }, outputSchema: { type: "object" }, handler: async (input) => buildRuntime(String(input.workspaceId)).executeFlow(String(input.flowId), input.input) }
|
|
237
244
|
}
|
|
238
245
|
};
|
|
239
246
|
const service = createService(definition);
|
|
@@ -7,15 +7,6 @@ import {
|
|
|
7
7
|
instantiateSubgraph
|
|
8
8
|
} from "./chunk-S22PMERU.js";
|
|
9
9
|
import "./chunk-RHRXPY2U.js";
|
|
10
|
-
import {
|
|
11
|
-
LifecycleCycleError,
|
|
12
|
-
LifecycleGraph,
|
|
13
|
-
SKIPO_STATE,
|
|
14
|
-
SkipoStateEngine,
|
|
15
|
-
useLifecycleScope,
|
|
16
|
-
useSkipoBind,
|
|
17
|
-
useSkipoState
|
|
18
|
-
} from "./chunk-EW4ACSZB.js";
|
|
19
10
|
import {
|
|
20
11
|
AttractionEngine,
|
|
21
12
|
GhostInferenceEngine,
|
|
@@ -31,6 +22,15 @@ import {
|
|
|
31
22
|
WireTypeRegistry,
|
|
32
23
|
initializeDefaultGraphRules
|
|
33
24
|
} from "./chunk-TZOL3RN7.js";
|
|
25
|
+
import {
|
|
26
|
+
LifecycleCycleError,
|
|
27
|
+
LifecycleGraph,
|
|
28
|
+
SKIPO_STATE,
|
|
29
|
+
SkipoStateEngine,
|
|
30
|
+
useLifecycleScope,
|
|
31
|
+
useSkipoBind,
|
|
32
|
+
useSkipoState
|
|
33
|
+
} from "./chunk-EW4ACSZB.js";
|
|
34
34
|
import {
|
|
35
35
|
CommandApi,
|
|
36
36
|
GhostStore,
|