@holokai/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +396 -0
- package/dist/core/api/base.controller.d.ts +8 -0
- package/dist/core/api/base.controller.d.ts.map +1 -0
- package/dist/core/api/base.controller.js +41 -0
- package/dist/core/api/base.controller.js.map +1 -0
- package/dist/core/api/index.d.ts +3 -0
- package/dist/core/api/index.d.ts.map +1 -0
- package/dist/core/api/index.js +3 -0
- package/dist/core/api/index.js.map +1 -0
- package/dist/core/api/types.d.ts +19 -0
- package/dist/core/api/types.d.ts.map +1 -0
- package/dist/core/api/types.js +2 -0
- package/dist/core/api/types.js.map +1 -0
- package/dist/core/entities/analysisResult.d.ts +8 -0
- package/dist/core/entities/analysisResult.d.ts.map +1 -0
- package/dist/core/entities/analysisResult.js +2 -0
- package/dist/core/entities/analysisResult.js.map +1 -0
- package/dist/core/entities/application.d.ts +12 -0
- package/dist/core/entities/application.d.ts.map +1 -0
- package/dist/core/entities/application.js +2 -0
- package/dist/core/entities/application.js.map +1 -0
- package/dist/core/entities/base.d.ts +8 -0
- package/dist/core/entities/base.d.ts.map +1 -0
- package/dist/core/entities/base.js +2 -0
- package/dist/core/entities/base.js.map +1 -0
- package/dist/core/entities/evaluator.d.ts +13 -0
- package/dist/core/entities/evaluator.d.ts.map +1 -0
- package/dist/core/entities/evaluator.data.d.ts +9 -0
- package/dist/core/entities/evaluator.data.d.ts.map +1 -0
- package/dist/core/entities/evaluator.data.js +2 -0
- package/dist/core/entities/evaluator.data.js.map +1 -0
- package/dist/core/entities/evaluator.js +2 -0
- package/dist/core/entities/evaluator.js.map +1 -0
- package/dist/core/entities/index.d.ts +11 -0
- package/dist/core/entities/index.d.ts.map +1 -0
- package/dist/core/entities/index.js +3 -0
- package/dist/core/entities/index.js.map +1 -0
- package/dist/core/entities/llm.request.d.ts +19 -0
- package/dist/core/entities/llm.request.d.ts.map +1 -0
- package/dist/core/entities/llm.request.js +2 -0
- package/dist/core/entities/llm.request.js.map +1 -0
- package/dist/core/entities/llm.response.d.ts +24 -0
- package/dist/core/entities/llm.response.d.ts.map +1 -0
- package/dist/core/entities/llm.response.js +3 -0
- package/dist/core/entities/llm.response.js.map +1 -0
- package/dist/core/entities/llm.status.d.ts +9 -0
- package/dist/core/entities/llm.status.d.ts.map +1 -0
- package/dist/core/entities/llm.status.js +11 -0
- package/dist/core/entities/llm.status.js.map +1 -0
- package/dist/core/entities/model.d.ts +14 -0
- package/dist/core/entities/model.d.ts.map +1 -0
- package/dist/core/entities/model.js +2 -0
- package/dist/core/entities/model.js.map +1 -0
- package/dist/core/entities/provider.d.ts +12 -0
- package/dist/core/entities/provider.d.ts.map +1 -0
- package/dist/core/entities/provider.js +2 -0
- package/dist/core/entities/provider.js.map +1 -0
- package/dist/core/id/index.d.ts +2 -0
- package/dist/core/id/index.d.ts.map +1 -0
- package/dist/core/id/index.js +13 -0
- package/dist/core/id/index.js.map +1 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +7 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/logger/holo-logger-factory.d.ts +6 -0
- package/dist/core/logger/holo-logger-factory.d.ts.map +1 -0
- package/dist/core/logger/holo-logger-factory.js +16 -0
- package/dist/core/logger/holo-logger-factory.js.map +1 -0
- package/dist/core/logger/index.d.ts +4 -0
- package/dist/core/logger/index.d.ts.map +1 -0
- package/dist/core/logger/index.js +4 -0
- package/dist/core/logger/index.js.map +1 -0
- package/dist/core/logger/logger.d.ts +24 -0
- package/dist/core/logger/logger.d.ts.map +1 -0
- package/dist/core/logger/logger.js +16 -0
- package/dist/core/logger/logger.js.map +1 -0
- package/dist/core/logger/mixin.d.ts +29 -0
- package/dist/core/logger/mixin.d.ts.map +1 -0
- package/dist/core/logger/mixin.js +29 -0
- package/dist/core/logger/mixin.js.map +1 -0
- package/dist/core/mixins/constructor.d.ts +2 -0
- package/dist/core/mixins/constructor.d.ts.map +1 -0
- package/dist/core/mixins/constructor.js +2 -0
- package/dist/core/mixins/constructor.js.map +1 -0
- package/dist/core/mixins/index.d.ts +2 -0
- package/dist/core/mixins/index.d.ts.map +1 -0
- package/dist/core/mixins/index.js +2 -0
- package/dist/core/mixins/index.js.map +1 -0
- package/dist/core/parsers/find-last.d.ts +3 -0
- package/dist/core/parsers/find-last.d.ts.map +1 -0
- package/dist/core/parsers/find-last.js +22 -0
- package/dist/core/parsers/find-last.js.map +1 -0
- package/dist/core/parsers/index.d.ts +6 -0
- package/dist/core/parsers/index.d.ts.map +1 -0
- package/dist/core/parsers/index.js +6 -0
- package/dist/core/parsers/index.js.map +1 -0
- package/dist/core/parsers/parsers.d.ts +6 -0
- package/dist/core/parsers/parsers.d.ts.map +1 -0
- package/dist/core/parsers/parsers.js +32 -0
- package/dist/core/parsers/parsers.js.map +1 -0
- package/dist/core/parsers/pick-defined.d.ts +2 -0
- package/dist/core/parsers/pick-defined.d.ts.map +1 -0
- package/dist/core/parsers/pick-defined.js +4 -0
- package/dist/core/parsers/pick-defined.js.map +1 -0
- package/dist/core/parsers/pick-headers.d.ts +3 -0
- package/dist/core/parsers/pick-headers.d.ts.map +1 -0
- package/dist/core/parsers/pick-headers.js +41 -0
- package/dist/core/parsers/pick-headers.js.map +1 -0
- package/dist/core/parsers/safe-parse.d.ts +2 -0
- package/dist/core/parsers/safe-parse.d.ts.map +1 -0
- package/dist/core/parsers/safe-parse.js +12 -0
- package/dist/core/parsers/safe-parse.js.map +1 -0
- package/dist/core/routes.d.ts +19 -0
- package/dist/core/routes.d.ts.map +1 -0
- package/dist/core/routes.js +8 -0
- package/dist/core/routes.js.map +1 -0
- package/dist/core/worker/envelopes.d.ts +27 -0
- package/dist/core/worker/envelopes.d.ts.map +1 -0
- package/dist/core/worker/envelopes.js +2 -0
- package/dist/core/worker/envelopes.js.map +1 -0
- package/dist/core/worker/index.d.ts +5 -0
- package/dist/core/worker/index.d.ts.map +1 -0
- package/dist/core/worker/index.js +5 -0
- package/dist/core/worker/index.js.map +1 -0
- package/dist/core/worker/prompt.d.ts +9 -0
- package/dist/core/worker/prompt.d.ts.map +1 -0
- package/dist/core/worker/prompt.js +2 -0
- package/dist/core/worker/prompt.js.map +1 -0
- package/dist/core/worker/request.d.ts +33 -0
- package/dist/core/worker/request.d.ts.map +1 -0
- package/dist/core/worker/request.js +2 -0
- package/dist/core/worker/request.js.map +1 -0
- package/dist/core/worker/response.d.ts +18 -0
- package/dist/core/worker/response.d.ts.map +1 -0
- package/dist/core/worker/response.js +2 -0
- package/dist/core/worker/response.js.map +1 -0
- package/dist/holo/content.d.ts +14 -0
- package/dist/holo/content.d.ts.map +1 -0
- package/dist/holo/content.js +7 -0
- package/dist/holo/content.js.map +1 -0
- package/dist/holo/factories/index.d.ts +3 -0
- package/dist/holo/factories/index.d.ts.map +1 -0
- package/dist/holo/factories/index.js +3 -0
- package/dist/holo/factories/index.js.map +1 -0
- package/dist/holo/factories/request-factory.d.ts +3 -0
- package/dist/holo/factories/request-factory.d.ts.map +1 -0
- package/dist/holo/factories/request-factory.js +8 -0
- package/dist/holo/factories/request-factory.js.map +1 -0
- package/dist/holo/factories/response-factory.d.ts +7 -0
- package/dist/holo/factories/response-factory.d.ts.map +1 -0
- package/dist/holo/factories/response-factory.js +64 -0
- package/dist/holo/factories/response-factory.js.map +1 -0
- package/dist/holo/index.d.ts +17 -0
- package/dist/holo/index.d.ts.map +1 -0
- package/dist/holo/index.js +19 -0
- package/dist/holo/index.js.map +1 -0
- package/dist/holo/messages.d.ts +10 -0
- package/dist/holo/messages.d.ts.map +1 -0
- package/dist/holo/messages.js +2 -0
- package/dist/holo/messages.js.map +1 -0
- package/dist/holo/requests.d.ts +32 -0
- package/dist/holo/requests.d.ts.map +1 -0
- package/dist/holo/requests.js +7 -0
- package/dist/holo/requests.js.map +1 -0
- package/dist/holo/responses.d.ts +57 -0
- package/dist/holo/responses.d.ts.map +1 -0
- package/dist/holo/responses.js +2 -0
- package/dist/holo/responses.js.map +1 -0
- package/dist/holo/tools.d.ts +25 -0
- package/dist/holo/tools.d.ts.map +1 -0
- package/dist/holo/tools.js +2 -0
- package/dist/holo/tools.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/base.d.ts +109 -0
- package/dist/plugin/base.d.ts.map +1 -0
- package/dist/plugin/base.js +131 -0
- package/dist/plugin/base.js.map +1 -0
- package/dist/plugin/context.d.ts +21 -0
- package/dist/plugin/context.d.ts.map +1 -0
- package/dist/plugin/context.js +2 -0
- package/dist/plugin/context.js.map +1 -0
- package/dist/plugin/errors.d.ts +24 -0
- package/dist/plugin/errors.d.ts.map +1 -0
- package/dist/plugin/errors.js +31 -0
- package/dist/plugin/errors.js.map +1 -0
- package/dist/plugin/evaluator.d.ts +243 -0
- package/dist/plugin/evaluator.d.ts.map +1 -0
- package/dist/plugin/evaluator.js +2 -0
- package/dist/plugin/evaluator.js.map +1 -0
- package/dist/plugin/guard.d.ts +307 -0
- package/dist/plugin/guard.d.ts.map +1 -0
- package/dist/plugin/guard.js +46 -0
- package/dist/plugin/guard.js.map +1 -0
- package/dist/plugin/index.d.ts +14 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +14 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/manifest.d.ts +349 -0
- package/dist/plugin/manifest.d.ts.map +1 -0
- package/dist/plugin/manifest.js +6 -0
- package/dist/plugin/manifest.js.map +1 -0
- package/dist/plugin/provider.d.ts +55 -0
- package/dist/plugin/provider.d.ts.map +1 -0
- package/dist/plugin/provider.js +2 -0
- package/dist/plugin/provider.js.map +1 -0
- package/dist/plugin/registry.d.ts +7 -0
- package/dist/plugin/registry.d.ts.map +1 -0
- package/dist/plugin/registry.js +2 -0
- package/dist/plugin/registry.js.map +1 -0
- package/dist/provider/auditor/base.d.ts +21 -0
- package/dist/provider/auditor/base.d.ts.map +1 -0
- package/dist/provider/auditor/base.js +58 -0
- package/dist/provider/auditor/base.js.map +1 -0
- package/dist/provider/auditor/index.d.ts +2 -0
- package/dist/provider/auditor/index.d.ts.map +1 -0
- package/dist/provider/auditor/index.js +2 -0
- package/dist/provider/auditor/index.js.map +1 -0
- package/dist/provider/base.d.ts +39 -0
- package/dist/provider/base.d.ts.map +1 -0
- package/dist/provider/base.js +169 -0
- package/dist/provider/base.js.map +1 -0
- package/dist/provider/index.d.ts +6 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +6 -0
- package/dist/provider/index.js.map +1 -0
- package/dist/provider/translator/base.d.ts +32 -0
- package/dist/provider/translator/base.d.ts.map +1 -0
- package/dist/provider/translator/base.js +33 -0
- package/dist/provider/translator/base.js.map +1 -0
- package/dist/provider/translator/index.d.ts +3 -0
- package/dist/provider/translator/index.d.ts.map +1 -0
- package/dist/provider/translator/index.js +3 -0
- package/dist/provider/translator/index.js.map +1 -0
- package/dist/provider/translator/stream.d.ts +24 -0
- package/dist/provider/translator/stream.d.ts.map +1 -0
- package/dist/provider/translator/stream.js +50 -0
- package/dist/provider/translator/stream.js.map +1 -0
- package/dist/provider/types.d.ts +107 -0
- package/dist/provider/types.d.ts.map +1 -0
- package/dist/provider/types.js +38 -0
- package/dist/provider/types.js.map +1 -0
- package/dist/provider/wire/base.d.ts +50 -0
- package/dist/provider/wire/base.d.ts.map +1 -0
- package/dist/provider/wire/base.js +99 -0
- package/dist/provider/wire/base.js.map +1 -0
- package/dist/provider/wire/index.d.ts +2 -0
- package/dist/provider/wire/index.d.ts.map +1 -0
- package/dist/provider/wire/index.js +2 -0
- package/dist/provider/wire/index.js.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin manifest schema for the Holo plugin system.
|
|
3
|
+
* Defines metadata, capabilities, and requirements for plugins.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Plugin type enumeration
|
|
7
|
+
*/
|
|
8
|
+
export type PluginType = 'provider' | 'guard' | 'evaluator' | 'logger' | 'worker';
|
|
9
|
+
/**
|
|
10
|
+
* Plugin category for marketplace organization
|
|
11
|
+
*/
|
|
12
|
+
export type PluginCategory = 'ai-providers' | 'security' | 'monitoring' | 'evaluation' | 'processing' | 'integration' | 'utility';
|
|
13
|
+
/**
|
|
14
|
+
* Pricing model for marketplace plugins
|
|
15
|
+
*/
|
|
16
|
+
export interface PluginPricing {
|
|
17
|
+
model: 'free' | 'paid' | 'freemium' | 'subscription' | 'usage-based';
|
|
18
|
+
/**
|
|
19
|
+
* Price in base currency units (not cents).
|
|
20
|
+
* Specify whether per seat, per org, etc. in documentation.
|
|
21
|
+
*/
|
|
22
|
+
price?: number;
|
|
23
|
+
currency?: string;
|
|
24
|
+
billingPeriod?: 'monthly' | 'yearly' | 'one-time';
|
|
25
|
+
trialDays?: number;
|
|
26
|
+
pricingUrl?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Support information for plugin users
|
|
30
|
+
*/
|
|
31
|
+
export interface PluginSupport {
|
|
32
|
+
email?: string;
|
|
33
|
+
url?: string;
|
|
34
|
+
discord?: string;
|
|
35
|
+
slack?: string;
|
|
36
|
+
/**
|
|
37
|
+
* URL pointing to documentation index/homepage
|
|
38
|
+
*/
|
|
39
|
+
documentation?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Plugin capabilities declaration
|
|
43
|
+
*/
|
|
44
|
+
export interface PluginCapabilities {
|
|
45
|
+
/**
|
|
46
|
+
* Supports configuration hot reload without restart
|
|
47
|
+
*/
|
|
48
|
+
supportsHotReload?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Can operate in distributed/clustered mode
|
|
51
|
+
*/
|
|
52
|
+
supportsDistributed?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Supports async/background processing
|
|
55
|
+
*/
|
|
56
|
+
supportsAsync?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Supports request batching
|
|
59
|
+
*/
|
|
60
|
+
supportsBatching?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Supports streaming responses
|
|
63
|
+
*/
|
|
64
|
+
supportsStreaming?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Custom capability flags (e.g. "supportsMultiTenant": true).
|
|
67
|
+
* Keys SHOULD be stable and documented per plugin or plugin type.
|
|
68
|
+
* Values must be boolean or numeric capabilities.
|
|
69
|
+
*/
|
|
70
|
+
[key: string]: boolean | number | undefined;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* JSON Schema node definition (Draft 7–style).
|
|
74
|
+
*
|
|
75
|
+
* This represents a generic schema node that can be used at any level
|
|
76
|
+
* (root, property, items, nested objects, etc.).
|
|
77
|
+
*/
|
|
78
|
+
export interface JSONSchemaProperty {
|
|
79
|
+
type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'null';
|
|
80
|
+
description?: string;
|
|
81
|
+
default?: string | number | boolean | null | object | Array<unknown>;
|
|
82
|
+
enum?: Array<string | number | boolean | null>;
|
|
83
|
+
const?: string | number | boolean | null;
|
|
84
|
+
minLength?: number;
|
|
85
|
+
maxLength?: number;
|
|
86
|
+
pattern?: string;
|
|
87
|
+
format?: string;
|
|
88
|
+
minimum?: number;
|
|
89
|
+
maximum?: number;
|
|
90
|
+
exclusiveMinimum?: number;
|
|
91
|
+
exclusiveMaximum?: number;
|
|
92
|
+
multipleOf?: number;
|
|
93
|
+
items?: JSONSchemaProperty | JSONSchemaProperty[];
|
|
94
|
+
minItems?: number;
|
|
95
|
+
maxItems?: number;
|
|
96
|
+
uniqueItems?: boolean;
|
|
97
|
+
properties?: Record<string, JSONSchemaProperty>;
|
|
98
|
+
required?: string[];
|
|
99
|
+
additionalProperties?: boolean | JSONSchemaProperty;
|
|
100
|
+
patternProperties?: Record<string, JSONSchemaProperty>;
|
|
101
|
+
allOf?: JSONSchemaProperty[];
|
|
102
|
+
anyOf?: JSONSchemaProperty[];
|
|
103
|
+
oneOf?: JSONSchemaProperty[];
|
|
104
|
+
not?: JSONSchemaProperty;
|
|
105
|
+
$ref?: string;
|
|
106
|
+
title?: string;
|
|
107
|
+
examples?: unknown[];
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Configuration schema for runtime validation.
|
|
111
|
+
*
|
|
112
|
+
* This is the *root* JSON Schema object for a plugin's configuration and
|
|
113
|
+
* must describe an object shape. It is what the host uses to validate
|
|
114
|
+
* user-provided configuration for this plugin.
|
|
115
|
+
*/
|
|
116
|
+
export interface ConfigSchema extends JSONSchemaProperty {
|
|
117
|
+
/**
|
|
118
|
+
* JSON Schema dialect identifier (optional).
|
|
119
|
+
* Example: "http://json-schema.org/draft-07/schema#"
|
|
120
|
+
*/
|
|
121
|
+
$schema?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Type of the root configuration object.
|
|
124
|
+
* Must be "object" for all plugin configs.
|
|
125
|
+
*/
|
|
126
|
+
type: 'object';
|
|
127
|
+
/**
|
|
128
|
+
* Property definitions for the configuration object.
|
|
129
|
+
*/
|
|
130
|
+
properties: Record<string, JSONSchemaProperty>;
|
|
131
|
+
/**
|
|
132
|
+
* Required properties for the configuration object.
|
|
133
|
+
*/
|
|
134
|
+
required?: string[];
|
|
135
|
+
/**
|
|
136
|
+
* Additional properties allowed on the configuration object.
|
|
137
|
+
*/
|
|
138
|
+
additionalProperties?: boolean | JSONSchemaProperty;
|
|
139
|
+
/**
|
|
140
|
+
* Pattern-based property definitions for the configuration object.
|
|
141
|
+
*/
|
|
142
|
+
patternProperties?: Record<string, JSONSchemaProperty>;
|
|
143
|
+
/**
|
|
144
|
+
* Dependencies between properties on the configuration object.
|
|
145
|
+
*/
|
|
146
|
+
dependencies?: Record<string, string[] | JSONSchemaProperty>;
|
|
147
|
+
/**
|
|
148
|
+
* Minimum number of properties on the configuration object.
|
|
149
|
+
*/
|
|
150
|
+
minProperties?: number;
|
|
151
|
+
/**
|
|
152
|
+
* Maximum number of properties on the configuration object.
|
|
153
|
+
*/
|
|
154
|
+
maxProperties?: number;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Plugin manifest with comprehensive metadata
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const manifest: PluginManifest = {
|
|
162
|
+
* // Required fields
|
|
163
|
+
* name: '@holokai/provider-openai',
|
|
164
|
+
* version: '1.0.0',
|
|
165
|
+
* pluginType: 'provider',
|
|
166
|
+
* displayName: 'OpenAI Provider',
|
|
167
|
+
* description: 'Official OpenAI integration for Holo',
|
|
168
|
+
*
|
|
169
|
+
* // Optional metadata
|
|
170
|
+
* author: 'Holo Team',
|
|
171
|
+
* license: 'MIT',
|
|
172
|
+
* homepage: 'https://docs.holo.ai/plugins/openai',
|
|
173
|
+
* repository: {
|
|
174
|
+
* type: 'git',
|
|
175
|
+
* url: 'https://github.com/holo-ai/provider-openai'
|
|
176
|
+
* },
|
|
177
|
+
*
|
|
178
|
+
* // Technical requirements
|
|
179
|
+
* engineVersion: '>=1.0.0',
|
|
180
|
+
* dependencies: {
|
|
181
|
+
* 'openai': '^4.0.0'
|
|
182
|
+
* },
|
|
183
|
+
*
|
|
184
|
+
* // Capabilities
|
|
185
|
+
* capabilities: {
|
|
186
|
+
* supportsStreaming: true,
|
|
187
|
+
* supportsHotReload: true
|
|
188
|
+
* },
|
|
189
|
+
*
|
|
190
|
+
* // Permissions
|
|
191
|
+
* permissions: ['network']
|
|
192
|
+
* };
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
export interface PluginManifest {
|
|
196
|
+
/**
|
|
197
|
+
* Unique plugin identifier and canonical key in the Holo ecosystem.
|
|
198
|
+
* Follows npm naming conventions and is used as the plugin ID everywhere
|
|
199
|
+
* (registry key, internal maps, etc.).
|
|
200
|
+
* Should be scoped (e.g., @org/plugin-name) for published plugins.
|
|
201
|
+
*/
|
|
202
|
+
name: string;
|
|
203
|
+
/**
|
|
204
|
+
* Semantic version of the plugin (e.g., "1.2.3").
|
|
205
|
+
* Must follow semver specification.
|
|
206
|
+
*/
|
|
207
|
+
version: string;
|
|
208
|
+
/**
|
|
209
|
+
* Type of plugin functionality.
|
|
210
|
+
* Determines which interface the plugin must implement.
|
|
211
|
+
*/
|
|
212
|
+
pluginType: PluginType;
|
|
213
|
+
/**
|
|
214
|
+
* Plugin family identifier for grouping related plugins.
|
|
215
|
+
* Used for version management and plugin resolution.
|
|
216
|
+
*/
|
|
217
|
+
family?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Human-readable name for UI display.
|
|
220
|
+
* Used in marketplace and admin interfaces.
|
|
221
|
+
*/
|
|
222
|
+
displayName: string;
|
|
223
|
+
/**
|
|
224
|
+
* Brief description of plugin functionality.
|
|
225
|
+
* Should be 1-2 sentences explaining what the plugin does.
|
|
226
|
+
*/
|
|
227
|
+
description: string;
|
|
228
|
+
/**
|
|
229
|
+
* Plugin author or organization.
|
|
230
|
+
* Can be a string or an object with name, email, and url.
|
|
231
|
+
*/
|
|
232
|
+
author?: string | {
|
|
233
|
+
name: string;
|
|
234
|
+
email?: string;
|
|
235
|
+
url?: string;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* License identifier (SPDX format preferred).
|
|
239
|
+
* Examples: "MIT", "Apache-2.0", "GPL-3.0"
|
|
240
|
+
*/
|
|
241
|
+
license?: string;
|
|
242
|
+
/**
|
|
243
|
+
* Plugin homepage URL.
|
|
244
|
+
* Should link to documentation or marketing page.
|
|
245
|
+
*/
|
|
246
|
+
homepage?: string;
|
|
247
|
+
/**
|
|
248
|
+
* Source code repository information.
|
|
249
|
+
* Follows npm package.json repository format.
|
|
250
|
+
*/
|
|
251
|
+
repository?: string | {
|
|
252
|
+
type: string;
|
|
253
|
+
url: string;
|
|
254
|
+
directory?: string;
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Issue tracker URL.
|
|
258
|
+
* Where users can report bugs or request features.
|
|
259
|
+
*/
|
|
260
|
+
bugs?: string | {
|
|
261
|
+
url?: string;
|
|
262
|
+
email?: string;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Searchable keywords for plugin discovery.
|
|
266
|
+
* Used in marketplace search and filtering.
|
|
267
|
+
*/
|
|
268
|
+
keywords?: string[];
|
|
269
|
+
/**
|
|
270
|
+
* Required host/engine version range (semver).
|
|
271
|
+
* Example: ">=1.0.0 <2.0.0"
|
|
272
|
+
*/
|
|
273
|
+
engineVersion?: string;
|
|
274
|
+
/**
|
|
275
|
+
* Runtime dependencies required by the plugin.
|
|
276
|
+
* Uses npm-style dependency specification.
|
|
277
|
+
*/
|
|
278
|
+
dependencies?: Record<string, string>;
|
|
279
|
+
/**
|
|
280
|
+
* Peer dependencies expected in the host environment.
|
|
281
|
+
* Used for shared dependencies to avoid duplication.
|
|
282
|
+
*/
|
|
283
|
+
peerDependencies?: Record<string, string>;
|
|
284
|
+
/**
|
|
285
|
+
* Plugin capability declarations.
|
|
286
|
+
* Used by the host to understand plugin features.
|
|
287
|
+
*/
|
|
288
|
+
capabilities?: PluginCapabilities;
|
|
289
|
+
/**
|
|
290
|
+
* Required permissions for plugin operation.
|
|
291
|
+
* Examples: ["network", "filesystem", "env"]
|
|
292
|
+
* The host is responsible for enforcing or denying these.
|
|
293
|
+
* This is the canonical list of required runtime permissions.
|
|
294
|
+
*/
|
|
295
|
+
permissions?: string[];
|
|
296
|
+
/**
|
|
297
|
+
* JSON Schema for configuration validation.
|
|
298
|
+
* Should be a valid JSON Schema object with "type": "object" at the root.
|
|
299
|
+
* Used to validate plugin configuration at runtime.
|
|
300
|
+
*/
|
|
301
|
+
configSchema?: ConfigSchema;
|
|
302
|
+
/**
|
|
303
|
+
* Marketplace category for plugin organization.
|
|
304
|
+
*/
|
|
305
|
+
category?: PluginCategory;
|
|
306
|
+
/**
|
|
307
|
+
* Screenshot URLs for marketplace display.
|
|
308
|
+
* Should be publicly accessible image URLs.
|
|
309
|
+
*/
|
|
310
|
+
screenshots?: string[];
|
|
311
|
+
/**
|
|
312
|
+
* URL to plugin changelog.
|
|
313
|
+
* Used to communicate updates to users.
|
|
314
|
+
*/
|
|
315
|
+
changelog?: string;
|
|
316
|
+
/**
|
|
317
|
+
* Pricing information for commercial plugins.
|
|
318
|
+
*/
|
|
319
|
+
pricing?: PluginPricing;
|
|
320
|
+
/**
|
|
321
|
+
* Support contact information.
|
|
322
|
+
*/
|
|
323
|
+
support?: PluginSupport;
|
|
324
|
+
/**
|
|
325
|
+
* Minimum supported previous version (semver range) for in-place upgrades.
|
|
326
|
+
* Used to determine safe upgrade paths and migration steps.
|
|
327
|
+
* Example: ">=0.9.0"
|
|
328
|
+
*/
|
|
329
|
+
upgradeFrom?: string;
|
|
330
|
+
/**
|
|
331
|
+
* Plugin entrypoint file (relative to package root).
|
|
332
|
+
* Defaults to "dist/index.js" if not specified.
|
|
333
|
+
*/
|
|
334
|
+
main?: string;
|
|
335
|
+
/**
|
|
336
|
+
* TypeScript type definitions file.
|
|
337
|
+
* Used for TypeScript integration.
|
|
338
|
+
*/
|
|
339
|
+
types?: string;
|
|
340
|
+
/**
|
|
341
|
+
* Custom metadata for future extensions.
|
|
342
|
+
* Allows plugins to include additional metadata.
|
|
343
|
+
* Values must be primitive types or arrays of primitives.
|
|
344
|
+
*/
|
|
345
|
+
custom?: {
|
|
346
|
+
[key: string]: string | number | boolean | string[] | number[] | undefined;
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/plugin/manifest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElF;;GAEG;AACH,MAAM,MAA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,CAAC;IAEf;;;;OAIG;IACH,MAAM,CAAC,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,EAAE,GACR,MAAM,EAAE,GACR,SAAS,CAAC;KACnB,CAAC;CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/plugin/manifest.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { IProvider, IProviderTranslator, IWireAdapter, ProviderCapabilities as ProviderFeatures, WireAdapterParams } from '../provider/index';
|
|
2
|
+
import { IPlugin } from "./base";
|
|
3
|
+
import { RouteHandler, RouteTree } from "../core/routes";
|
|
4
|
+
/**
|
|
5
|
+
* Provider plugin interface for LLM integrations.
|
|
6
|
+
* @template TProvider The type of provider instance created by this plugin.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* class OpenAIPlugin
|
|
11
|
+
* extends BasePlugin
|
|
12
|
+
* implements IProviderPlugin<OpenAIProvider>
|
|
13
|
+
* {
|
|
14
|
+
* async createProvider(config: ProviderConfig): Promise<OpenAIProvider> {
|
|
15
|
+
* return new OpenAIProvider(config);
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* async validateConfig(config: ProviderConfig): Promise<boolean> {
|
|
19
|
+
* return !!config.api_key && !!config.model;
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* getCapabilities(): ProviderFeatures {
|
|
23
|
+
* return {
|
|
24
|
+
* streaming: true,
|
|
25
|
+
* embedding: true,
|
|
26
|
+
* vision: true,
|
|
27
|
+
* function_calling: true,
|
|
28
|
+
* supported_models: ['gpt-4', 'gpt-3.5-turbo']
|
|
29
|
+
* };
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* getSupportedModels(): string[] {
|
|
33
|
+
* return this.getCapabilities().supported_models;
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export interface IProviderPlugin<TProvider = IProvider> extends IPlugin {
|
|
39
|
+
translator: IProviderTranslator;
|
|
40
|
+
defaultRouteHandler?: RouteHandler;
|
|
41
|
+
/**
|
|
42
|
+
* Create a provider instance with the given configuration.
|
|
43
|
+
* @param config Provider configuration including API keys and model settings.
|
|
44
|
+
* @returns Promise resolving to a provider instance.
|
|
45
|
+
*/
|
|
46
|
+
createProvider(config: any): Promise<TProvider>;
|
|
47
|
+
/**
|
|
48
|
+
* Get provider capabilities.
|
|
49
|
+
* @returns Provider capabilities including supported features and models.
|
|
50
|
+
*/
|
|
51
|
+
getCapabilities(): ProviderFeatures;
|
|
52
|
+
getRoutes(): RouteTree;
|
|
53
|
+
createWireAdapter(params: WireAdapterParams): IWireAdapter;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/plugin/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,IAAI,gBAAgB,EACxC,iBAAiB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,eAAe,CAAC,SAAS,GAAG,SAAS,CAAE,SAAQ,OAAO;IACnE,UAAU,EAAE,mBAAmB,CAAA;IAC/B,mBAAmB,CAAC,EAAE,YAAY,CAAA;IAElC;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhD;;;OAGG;IACH,eAAe,IAAI,gBAAgB,CAAC;IAEpC,SAAS,IAAI,SAAS,CAAC;IAEvB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,YAAY,CAAC;CAE9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/plugin/provider.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IPlugin } from "./base";
|
|
2
|
+
export interface IPluginRegistry<T extends IPlugin> {
|
|
3
|
+
registerPlugin(plugin: T, version?: string, isLatest?: boolean): void;
|
|
4
|
+
unregisterPlugin(id: string, version?: string): void;
|
|
5
|
+
listPlugins(): T[];
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugin/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAE/B,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,OAAO;IAC9C,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAEtE,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErD,WAAW,IAAI,CAAC,EAAE,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/plugin/registry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HoloWorkerRequest, WorkerRequestEnvelope, WorkerResponseEnvelope } from "../../core/worker";
|
|
2
|
+
import { ClassLogger } from "../../core";
|
|
3
|
+
import { ProviderEnvelope, ProviderEvent } from "../types";
|
|
4
|
+
import { LlmRequest, LlmResponse } from "../../core/entities";
|
|
5
|
+
export interface IAuditor {
|
|
6
|
+
readonly provider: string;
|
|
7
|
+
auditRequest(workerRequest: HoloWorkerRequest): Promise<LlmRequest>;
|
|
8
|
+
createWorkerResponseEnvelope(workerRequest: HoloWorkerRequest, workerId?: string): Promise<WorkerResponseEnvelope>;
|
|
9
|
+
auditResponse(responseEnvelope: WorkerResponseEnvelope, providerEvent: ProviderEvent): Promise<LlmResponse>;
|
|
10
|
+
}
|
|
11
|
+
export declare abstract class BaseAuditor extends ClassLogger implements IAuditor {
|
|
12
|
+
abstract readonly provider: string;
|
|
13
|
+
createWorkerRequestEnvelope(workerRequest: HoloWorkerRequest): Promise<WorkerRequestEnvelope>;
|
|
14
|
+
createWorkerResponseEnvelope(workerRequest: HoloWorkerRequest, workerId?: string): Promise<WorkerResponseEnvelope>;
|
|
15
|
+
auditRequest(workerRequest: HoloWorkerRequest): Promise<LlmRequest>;
|
|
16
|
+
protected abstract toHoloRequest(workerRequest: HoloWorkerRequest, llmRequest: Omit<LlmRequest, 'id'>): void;
|
|
17
|
+
protected abstract mapProviderPayload(workerRequest: HoloWorkerRequest, llmRequest: Omit<LlmRequest, 'id'>): void;
|
|
18
|
+
auditResponse(responseEnvelope: WorkerResponseEnvelope, providerEvent: ProviderEvent): Promise<LlmResponse>;
|
|
19
|
+
protected abstract createProviderEnvelope(payload: any): Promise<ProviderEnvelope>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/provider/auditor/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,qBAAqB,EAAE,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAC,WAAW,EAAc,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,UAAU,CAAC;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B,CAAC;CAC/B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ClassLogger, pickDefined } from "../../core";
|
|
2
|
+
import { LlmStatus } from "../../core/entities";
|
|
3
|
+
export class BaseAuditor extends ClassLogger {
|
|
4
|
+
async createWorkerRequestEnvelope(workerRequest) {
|
|
5
|
+
const logger = this.mlog(this.createWorkerResponseEnvelope);
|
|
6
|
+
if (!workerRequest.requestId) {
|
|
7
|
+
logger.error(`No requestId for workerRequest: ${JSON.stringify(workerRequest)}`);
|
|
8
|
+
}
|
|
9
|
+
const providerEnvelope = await this.createProviderEnvelope(workerRequest.payload);
|
|
10
|
+
return pickDefined({
|
|
11
|
+
request_id: workerRequest.requestId,
|
|
12
|
+
request_type: workerRequest.type,
|
|
13
|
+
organization_id: workerRequest.organizationId,
|
|
14
|
+
application_id: workerRequest.appSlug ?? 'default',
|
|
15
|
+
user_id: workerRequest.userId,
|
|
16
|
+
provider_slug: workerRequest.providerName,
|
|
17
|
+
timestamp: new Date(workerRequest.timestamp).toISOString(),
|
|
18
|
+
source_id: workerRequest.sourceId,
|
|
19
|
+
thread_id: workerRequest.thread_id,
|
|
20
|
+
branch_id: workerRequest.branch_id,
|
|
21
|
+
raw_request: workerRequest.payload,
|
|
22
|
+
...providerEnvelope
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async createWorkerResponseEnvelope(workerRequest, workerId) {
|
|
26
|
+
return pickDefined({
|
|
27
|
+
worker_id: workerId,
|
|
28
|
+
request_id: workerRequest.requestId,
|
|
29
|
+
request_type: workerRequest.type,
|
|
30
|
+
organization_id: workerRequest.organizationId,
|
|
31
|
+
application_id: workerRequest.appSlug ?? 'default',
|
|
32
|
+
user_id: workerRequest.userId,
|
|
33
|
+
provider_slug: workerRequest.providerName,
|
|
34
|
+
...await this.createProviderEnvelope(workerRequest.payload)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async auditRequest(workerRequest) {
|
|
38
|
+
const requestEnvelope = await this.createWorkerRequestEnvelope(workerRequest);
|
|
39
|
+
const llmRequest = {
|
|
40
|
+
...requestEnvelope
|
|
41
|
+
};
|
|
42
|
+
// Call provider-specific mapping methods to extract user_prompt, options, etc.
|
|
43
|
+
this.toHoloRequest(workerRequest, llmRequest);
|
|
44
|
+
this.mapProviderPayload(workerRequest, llmRequest);
|
|
45
|
+
return pickDefined(llmRequest);
|
|
46
|
+
}
|
|
47
|
+
async auditResponse(responseEnvelope, providerEvent) {
|
|
48
|
+
return pickDefined({
|
|
49
|
+
...responseEnvelope,
|
|
50
|
+
created_at: providerEvent.ts ? new Date(providerEvent.ts).toISOString() : new Date().toISOString(),
|
|
51
|
+
status: LlmStatus.SUCCESS,
|
|
52
|
+
cost: 0,
|
|
53
|
+
response: providerEvent.type === 'done' || providerEvent.type === 'text_delta' ? providerEvent.text : JSON.stringify(providerEvent),
|
|
54
|
+
response_raw: providerEvent
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/provider/auditor/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAEpD,OAAO,EAA0B,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAgBvE,MAAM,OAAgB,WAAY,SAAQ,WAAW;IAGjD,KAAK,CAAC,2BAA2B,CAAC,aAAgC;QAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC5D,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,CAAC;YAC3B,MAAM,CAAC,KAAK,CAAC,mCAAmC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACrF,CAAC;QAED,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,aAAa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;QAC9C,IAAI,CAAC,kBAAkB,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;QAEnD,OAAO,WAAW,CAAC,UAAU,CAAe,CAAC;IACjD,CAAC;IAOD,KAAK,CAAC,aAAa,CACf,gBAAwC,EACxC,aAA4B;QAE5B,OAAO,WAAW,CAAC;YACf,GAAG,gBAAgB;YACnB,UAAU,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAClG,MAAM,EAAE,SAAS,CAAC,OAAO;YACzB,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,aAAa,CAAC,IAAI,KAAK,MAAM,IAAI,aAAa,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;YACnI,YAAY,EAAE,aAAoB;SACrC,CAAgB,CAAC;IACtB,CAAC;CAKJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/provider/auditor/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/provider/auditor/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AsyncEventQueue, IProvider, IResponseFactory, ModelInfo, ProviderContext, ProviderEvent } from "./types";
|
|
2
|
+
import { HoloWorkerRequest, WorkerRequestEnvelope } from "../core/worker/index";
|
|
3
|
+
import { ClassLogger } from "../core/index";
|
|
4
|
+
import { IAuditor } from "./auditor/index";
|
|
5
|
+
import { IProviderTranslator } from "./translator/index";
|
|
6
|
+
import { LlmRequest, LlmResponse } from "../core/entities/index";
|
|
7
|
+
export type ProviderRunner<Final = any> = {
|
|
8
|
+
final: () => Promise<Final>;
|
|
9
|
+
cancel?: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare abstract class BaseProvider<ProviderClient = any, RequestPayload = any, Final = any> extends ClassLogger implements IProvider {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly family: string;
|
|
14
|
+
readonly version: string;
|
|
15
|
+
protected readonly _config: any;
|
|
16
|
+
protected models: Record<string, ModelInfo>;
|
|
17
|
+
protected readonly client: ProviderClient;
|
|
18
|
+
readonly auditor: IAuditor;
|
|
19
|
+
readonly translator: IProviderTranslator;
|
|
20
|
+
readonly responseFactory: IResponseFactory;
|
|
21
|
+
constructor(name: string, family: string, version: string, _config: any);
|
|
22
|
+
protected abstract createClient(): ProviderClient;
|
|
23
|
+
protected abstract createAuditor(): IAuditor;
|
|
24
|
+
protected abstract createTranslator(): IProviderTranslator;
|
|
25
|
+
protected abstract createResponseFactory(): IResponseFactory;
|
|
26
|
+
abstract getModels(allowedModels: string[] | true): Promise<any>;
|
|
27
|
+
auditRequest(workerRequest: HoloWorkerRequest): Promise<LlmRequest>;
|
|
28
|
+
auditResponse(workerEnvelope: WorkerRequestEnvelope, providerEvent: ProviderEvent): Promise<LlmResponse>;
|
|
29
|
+
processWorkerRequest(request: HoloWorkerRequest, _opts?: {
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}): Promise<AsyncEventQueue<ProviderEvent>>;
|
|
32
|
+
protected abstract handleError(error: any): Promise<any>;
|
|
33
|
+
protected abstract handleRequest(payload: RequestPayload, ctx: ProviderContext): Promise<ProviderRunner<Final>>;
|
|
34
|
+
protected getHeaders(request: HoloWorkerRequest, config: any): Record<string, string>;
|
|
35
|
+
private createEventPusher;
|
|
36
|
+
private handlePassthrough;
|
|
37
|
+
get id(): string;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
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