@xpert-ai/plugin-sdk 3.15.18 → 3.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/index.cjs.js +101 -14
- package/index.esm.js +97 -14
- package/package.json +2 -3
- package/src/lib/ai-model/llm.d.ts +1 -0
- package/src/lib/core/permissions/bound-identity-login.d.ts +19 -1
- package/src/lib/core/permissions/index.d.ts +3 -3
- package/src/lib/core/permissions/video-generation.d.ts +159 -0
- package/src/lib/runtime/capabilities/actor-token.d.ts +15 -0
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
- package/src/lib/runtime/capabilities/workspace-files.d.ts +39 -0
- package/src/lib/sandbox/sandbox.interface.d.ts +6 -1
- package/src/lib/sandbox/terminal.d.ts +2 -0
- package/src/lib/toolset/strategy.interface.d.ts +3 -0
- package/src/lib/types.d.ts +3 -3
- package/src/lib/core/permissions/analytics.d.ts +0 -45
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @xpert-ai/plugin-sdk
|
|
2
2
|
|
|
3
|
+
## 3.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 57721a6: Normalize missing assistant roles in OpenAI-compatible completion responses.
|
|
8
|
+
|
|
9
|
+
## 3.16.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- b800da5: v3.16
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [b800da5]
|
|
18
|
+
- @xpert-ai/contracts@3.16.0
|
|
19
|
+
|
|
3
20
|
## 3.15.18
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/index.cjs.js
CHANGED
|
@@ -1203,10 +1203,6 @@ const PLUGIN_CONFIG_RESOLVER_TOKEN = 'XPERT_PLUGIN_CONFIG_RESOLVER';
|
|
|
1203
1203
|
* System token for resolving integration read service from plugin context.
|
|
1204
1204
|
*/ const INTEGRATION_PERMISSION_SERVICE_TOKEN = 'XPERT_PLUGIN_INTEGRATION_PERMISSION_SERVICE';
|
|
1205
1205
|
|
|
1206
|
-
/**
|
|
1207
|
-
* System token for resolving analytics permission service from plugin context.
|
|
1208
|
-
*/ const ANALYTICS_PERMISSION_SERVICE_TOKEN = 'XPERT_PLUGIN_ANALYTICS_PERMISSION_SERVICE';
|
|
1209
|
-
|
|
1210
1206
|
const PERMISSION_OPERATION_METADATA_KEY = 'XPERT_PLUGIN_PERMISSION_OPERATION';
|
|
1211
1207
|
function RequirePermissionOperation(permissionType, operation) {
|
|
1212
1208
|
return (_target, _propertyKey, descriptor)=>{
|
|
@@ -1264,6 +1260,14 @@ function getRequiredPermissionOperation(method, permissionType) {
|
|
|
1264
1260
|
* Internal system token used by core to expose the speech-to-text bridge.
|
|
1265
1261
|
*/ const SPEECH_TO_TEXT_SERVICE_TOKEN = 'XPERT_SPEECH_TO_TEXT_SERVICE';
|
|
1266
1262
|
|
|
1263
|
+
const VIDEO_GENERATOR_FAMILIES = [
|
|
1264
|
+
'seedance',
|
|
1265
|
+
'veo',
|
|
1266
|
+
'kling'
|
|
1267
|
+
];
|
|
1268
|
+
const VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN = 'XPERT_PLUGIN_VIDEO_GENERATION_PERMISSION_SERVICE';
|
|
1269
|
+
const VIDEO_GENERATION_SERVICE_TOKEN = 'XPERT_VIDEO_GENERATION_SERVICE';
|
|
1270
|
+
|
|
1267
1271
|
async function createI18nInstance(pluginDir, language) {
|
|
1268
1272
|
const instance = i18next.createInstance();
|
|
1269
1273
|
const i18nDir = path.join(pluginDir, 'i18n');
|
|
@@ -2441,17 +2445,15 @@ class LargeLanguageModel extends AIModel {
|
|
|
2441
2445
|
this.startedAt = performance.now();
|
|
2442
2446
|
},
|
|
2443
2447
|
handleLLMEnd: (output)=>{
|
|
2444
|
-
|
|
2445
|
-
var _output_llmOutput_tokenUsage, _ref;
|
|
2446
|
-
const tokenUsage = (_ref = (_output_llmOutput_tokenUsage = (_output_llmOutput = output.llmOutput) == null ? void 0 : _output_llmOutput.tokenUsage) != null ? _output_llmOutput_tokenUsage : (_output_llmOutput1 = output.llmOutput) == null ? void 0 : _output_llmOutput1.estimatedTokenUsage) != null ? _ref : calcTokenUsage(output);
|
|
2448
|
+
const tokenUsage = resolveTokenUsage(output);
|
|
2447
2449
|
if (handleLLMTokens) {
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
+
const usage = this.calcResponseUsage(model, credentials, tokenUsage.promptTokens, tokenUsage.completionTokens);
|
|
2451
|
+
usage.totalTokens = tokenUsage.totalTokens;
|
|
2450
2452
|
handleLLMTokens({
|
|
2451
2453
|
copilot,
|
|
2452
2454
|
model,
|
|
2453
|
-
usage
|
|
2454
|
-
tokenUsed:
|
|
2455
|
+
usage,
|
|
2456
|
+
tokenUsed: tokenUsage.totalTokens
|
|
2455
2457
|
});
|
|
2456
2458
|
}
|
|
2457
2459
|
}
|
|
@@ -2611,6 +2613,41 @@ function calcTokenUsage(output) {
|
|
|
2611
2613
|
});
|
|
2612
2614
|
return tokenUsage;
|
|
2613
2615
|
}
|
|
2616
|
+
function resolveTokenUsage(output) {
|
|
2617
|
+
var _output_llmOutput, _output_llmOutput1, _output_llmOutput2;
|
|
2618
|
+
var _normalizeTokenUsage, _ref, _ref1, _ref2;
|
|
2619
|
+
return (_ref2 = (_ref1 = (_ref = (_normalizeTokenUsage = normalizeTokenUsage(calcTokenUsage(output))) != null ? _normalizeTokenUsage : normalizeTokenUsage((_output_llmOutput = output.llmOutput) == null ? void 0 : _output_llmOutput['tokenUsage'])) != null ? _ref : normalizeTokenUsage((_output_llmOutput1 = output.llmOutput) == null ? void 0 : _output_llmOutput1['estimatedTokenUsage'])) != null ? _ref1 : normalizeTokenUsage({
|
|
2620
|
+
totalTokens: (_output_llmOutput2 = output.llmOutput) == null ? void 0 : _output_llmOutput2['totalTokens']
|
|
2621
|
+
})) != null ? _ref2 : {
|
|
2622
|
+
promptTokens: 0,
|
|
2623
|
+
completionTokens: 0,
|
|
2624
|
+
totalTokens: 0
|
|
2625
|
+
};
|
|
2626
|
+
}
|
|
2627
|
+
function normalizeTokenUsage(candidate) {
|
|
2628
|
+
if (!candidate) {
|
|
2629
|
+
return null;
|
|
2630
|
+
}
|
|
2631
|
+
if (!isValidTokenCount(candidate.promptTokens) || !isValidTokenCount(candidate.completionTokens) || !isValidTokenCount(candidate.totalTokens)) {
|
|
2632
|
+
return null;
|
|
2633
|
+
}
|
|
2634
|
+
var _candidate_promptTokens;
|
|
2635
|
+
const promptTokens = (_candidate_promptTokens = candidate.promptTokens) != null ? _candidate_promptTokens : 0;
|
|
2636
|
+
var _candidate_completionTokens;
|
|
2637
|
+
const completionTokens = (_candidate_completionTokens = candidate.completionTokens) != null ? _candidate_completionTokens : 0;
|
|
2638
|
+
const totalTokens = candidate.totalTokens || promptTokens + completionTokens;
|
|
2639
|
+
if (promptTokens === 0 && completionTokens === 0 && totalTokens === 0) {
|
|
2640
|
+
return null;
|
|
2641
|
+
}
|
|
2642
|
+
return {
|
|
2643
|
+
promptTokens,
|
|
2644
|
+
completionTokens,
|
|
2645
|
+
totalTokens
|
|
2646
|
+
};
|
|
2647
|
+
}
|
|
2648
|
+
function isValidTokenCount(value) {
|
|
2649
|
+
return value === undefined || Number.isFinite(value) && value >= 0;
|
|
2650
|
+
}
|
|
2614
2651
|
/**
|
|
2615
2652
|
* @deprecated use calcTokenUsage
|
|
2616
2653
|
*/ function sumTokenUsage(output) {
|
|
@@ -2642,7 +2679,12 @@ function calcTokenUsage(output) {
|
|
|
2642
2679
|
*
|
|
2643
2680
|
*/ _convertCompletionsDeltaToBaseMessageChunk(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2644
2681
|
delta, rawResponse, defaultRole) {
|
|
2645
|
-
|
|
2682
|
+
// Some OpenAI-compatible providers omit `delta.role` on the final usage
|
|
2683
|
+
// chunk. Without a role, LangChain creates a generic ChatMessageChunk;
|
|
2684
|
+
// persisting that chunk makes the next request contain `role: undefined`.
|
|
2685
|
+
// Treat role-less completion deltas as assistant output so they remain
|
|
2686
|
+
// valid both in the current stream and when the conversation is resumed.
|
|
2687
|
+
const messageChunk = super._convertCompletionsDeltaToBaseMessageChunk(delta, rawResponse, defaultRole != null ? defaultRole : 'assistant');
|
|
2646
2688
|
if (delta['content'] === '<think>') {
|
|
2647
2689
|
this.thinking = true;
|
|
2648
2690
|
messageChunk.content = '';
|
|
@@ -2658,7 +2700,14 @@ function calcTokenUsage(output) {
|
|
|
2658
2700
|
return messageChunk;
|
|
2659
2701
|
}
|
|
2660
2702
|
_convertCompletionsMessageToBaseMessage(message, rawResponse) {
|
|
2661
|
-
|
|
2703
|
+
var _message_role;
|
|
2704
|
+
// Some compatible providers also omit the role on non-stream responses.
|
|
2705
|
+
// Normalize that response before LangChain falls back to a generic
|
|
2706
|
+
// message with role `unknown`.
|
|
2707
|
+
const normalizedMessage = collaborationClient._extends({}, message, {
|
|
2708
|
+
role: (_message_role = message.role) != null ? _message_role : 'assistant'
|
|
2709
|
+
});
|
|
2710
|
+
const langChainMessage = super._convertCompletionsMessageToBaseMessage(normalizedMessage, rawResponse);
|
|
2662
2711
|
console.log(langChainMessage.content);
|
|
2663
2712
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2664
2713
|
if (message.reasoning_content) {
|
|
@@ -2851,6 +2900,10 @@ const KnowledgebaseDocumentsRuntimeCapability = createRuntimeCapability('platfor
|
|
|
2851
2900
|
description: 'Upload, import, create, process, inspect, and delete persistent knowledgebase documents.'
|
|
2852
2901
|
});
|
|
2853
2902
|
|
|
2903
|
+
const ActorTokenRuntimeCapability = createRuntimeCapability('platform.actor-token', {
|
|
2904
|
+
description: 'Mint a short-lived host-issued actor bearer token for outbound API calls.'
|
|
2905
|
+
});
|
|
2906
|
+
|
|
2854
2907
|
const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts', {
|
|
2855
2908
|
description: 'Create, version, preview, download, share, archive, and delete platform-managed plugin and Agent artifacts.'
|
|
2856
2909
|
});
|
|
@@ -4475,16 +4528,31 @@ const XPERT_REMOTE_UI_CSS = `
|
|
|
4475
4528
|
--xui-color-foreground: #18181b;
|
|
4476
4529
|
--xui-color-card: #fff;
|
|
4477
4530
|
--xui-color-card-foreground: #18181b;
|
|
4531
|
+
--xui-color-popover: var(--xui-color-card);
|
|
4532
|
+
--xui-color-popover-foreground: var(--xui-color-card-foreground);
|
|
4533
|
+
--xui-color-secondary: #f4f4f5;
|
|
4534
|
+
--xui-color-secondary-foreground: #18181b;
|
|
4478
4535
|
--xui-color-muted: #f4f4f5;
|
|
4479
4536
|
--xui-color-muted-foreground: #71717a;
|
|
4537
|
+
--xui-color-accent: #f4f4f5;
|
|
4538
|
+
--xui-color-accent-foreground: #18181b;
|
|
4480
4539
|
--xui-color-border: #e4e4e7;
|
|
4481
4540
|
--xui-color-input: #d4d4d8;
|
|
4482
4541
|
--xui-color-primary: #18181b;
|
|
4483
4542
|
--xui-color-primary-foreground: #fff;
|
|
4543
|
+
--xui-color-ring: var(--xui-color-primary);
|
|
4484
4544
|
--xui-color-destructive: #dc2626;
|
|
4545
|
+
--xui-color-destructive-foreground: #fff;
|
|
4485
4546
|
--xui-color-destructive-background: #fef2f2;
|
|
4486
4547
|
--xui-color-success: #047857;
|
|
4487
4548
|
--xui-color-success-background: #ecfdf5;
|
|
4549
|
+
--xui-color-warning: #b45309;
|
|
4550
|
+
--xui-color-info: #2563eb;
|
|
4551
|
+
--xui-color-chart-1: var(--xui-color-primary);
|
|
4552
|
+
--xui-color-chart-2: var(--xui-color-success);
|
|
4553
|
+
--xui-color-chart-3: var(--xui-color-warning);
|
|
4554
|
+
--xui-color-chart-4: var(--xui-color-destructive);
|
|
4555
|
+
--xui-color-chart-5: #7c3aed;
|
|
4488
4556
|
--xui-radius-sm: 6px;
|
|
4489
4557
|
--xui-radius-md: 8px;
|
|
4490
4558
|
--xui-radius-lg: 10px;
|
|
@@ -4779,16 +4847,31 @@ const XPERT_REMOTE_UI_BOOTSTRAP = `
|
|
|
4779
4847
|
colorForeground: '--xui-color-foreground',
|
|
4780
4848
|
colorCard: '--xui-color-card',
|
|
4781
4849
|
colorCardForeground: '--xui-color-card-foreground',
|
|
4850
|
+
colorPopover: '--xui-color-popover',
|
|
4851
|
+
colorPopoverForeground: '--xui-color-popover-foreground',
|
|
4852
|
+
colorSecondary: '--xui-color-secondary',
|
|
4853
|
+
colorSecondaryForeground: '--xui-color-secondary-foreground',
|
|
4782
4854
|
colorMuted: '--xui-color-muted',
|
|
4783
4855
|
colorMutedForeground: '--xui-color-muted-foreground',
|
|
4856
|
+
colorAccent: '--xui-color-accent',
|
|
4857
|
+
colorAccentForeground: '--xui-color-accent-foreground',
|
|
4784
4858
|
colorBorder: '--xui-color-border',
|
|
4785
4859
|
colorInput: '--xui-color-input',
|
|
4786
4860
|
colorPrimary: '--xui-color-primary',
|
|
4787
4861
|
colorPrimaryForeground: '--xui-color-primary-foreground',
|
|
4862
|
+
colorRing: '--xui-color-ring',
|
|
4788
4863
|
colorDestructive: '--xui-color-destructive',
|
|
4864
|
+
colorDestructiveForeground: '--xui-color-destructive-foreground',
|
|
4789
4865
|
colorDestructiveBackground: '--xui-color-destructive-background',
|
|
4790
4866
|
colorSuccess: '--xui-color-success',
|
|
4791
4867
|
colorSuccessBackground: '--xui-color-success-background',
|
|
4868
|
+
colorWarning: '--xui-color-warning',
|
|
4869
|
+
colorInfo: '--xui-color-info',
|
|
4870
|
+
colorChart1: '--xui-color-chart-1',
|
|
4871
|
+
colorChart2: '--xui-color-chart-2',
|
|
4872
|
+
colorChart3: '--xui-color-chart-3',
|
|
4873
|
+
colorChart4: '--xui-color-chart-4',
|
|
4874
|
+
colorChart5: '--xui-color-chart-5',
|
|
4792
4875
|
radiusSm: '--xui-radius-sm',
|
|
4793
4876
|
radiusMd: '--xui-radius-md',
|
|
4794
4877
|
radiusLg: '--xui-radius-lg',
|
|
@@ -4956,7 +5039,7 @@ exports.AGENT_MIDDLEWARE_STRATEGY = AGENT_MIDDLEWARE_STRATEGY;
|
|
|
4956
5039
|
exports.AIModelProviderNotFoundException = AIModelProviderNotFoundException;
|
|
4957
5040
|
exports.AIModelProviderStrategy = AIModelProviderStrategy;
|
|
4958
5041
|
exports.AI_MODEL_PROVIDER = AI_MODEL_PROVIDER;
|
|
4959
|
-
exports.
|
|
5042
|
+
exports.ActorTokenRuntimeCapability = ActorTokenRuntimeCapability;
|
|
4960
5043
|
exports.AdapterDataSourceStrategy = AdapterDataSourceStrategy;
|
|
4961
5044
|
exports.AgentMiddlewareStrategy = AgentMiddlewareStrategy;
|
|
4962
5045
|
exports.AiModelNotFoundException = AiModelNotFoundException;
|
|
@@ -5086,6 +5169,9 @@ exports.TextToSpeechModel = TextToSpeechModel;
|
|
|
5086
5169
|
exports.ToolsetStrategy = ToolsetStrategy;
|
|
5087
5170
|
exports.USER_PERMISSION_SERVICE_TOKEN = USER_PERMISSION_SERVICE_TOKEN;
|
|
5088
5171
|
exports.VECTOR_STORE_STRATEGY = VECTOR_STORE_STRATEGY;
|
|
5172
|
+
exports.VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN = VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN;
|
|
5173
|
+
exports.VIDEO_GENERATION_SERVICE_TOKEN = VIDEO_GENERATION_SERVICE_TOKEN;
|
|
5174
|
+
exports.VIDEO_GENERATOR_FAMILIES = VIDEO_GENERATOR_FAMILIES;
|
|
5089
5175
|
exports.VIEW_EXTENSION_CACHE_SERVICE_TOKEN = VIEW_EXTENSION_CACHE_SERVICE_TOKEN;
|
|
5090
5176
|
exports.VIEW_EXTENSION_PROVIDER = VIEW_EXTENSION_PROVIDER;
|
|
5091
5177
|
exports.VectorStoreStrategy = VectorStoreStrategy;
|
|
@@ -5149,6 +5235,7 @@ exports.resolveSandboxServiceProxyAdapter = resolveSandboxServiceProxyAdapter;
|
|
|
5149
5235
|
exports.resolveSandboxTerminalAdapter = resolveSandboxTerminalAdapter;
|
|
5150
5236
|
exports.resolveStrategyMetadataTarget = resolveStrategyMetadataTarget;
|
|
5151
5237
|
exports.resolveTenantGlobalScopeKey = resolveTenantGlobalScopeKey;
|
|
5238
|
+
exports.resolveTokenUsage = resolveTokenUsage;
|
|
5152
5239
|
exports.runWithRequestContext = runWithRequestContext;
|
|
5153
5240
|
exports.secondsToMilliseconds = secondsToMilliseconds;
|
|
5154
5241
|
exports.setDefaultTenantId = setDefaultTenantId;
|
package/index.esm.js
CHANGED
|
@@ -1185,10 +1185,6 @@ const PLUGIN_CONFIG_RESOLVER_TOKEN = 'XPERT_PLUGIN_CONFIG_RESOLVER';
|
|
|
1185
1185
|
* System token for resolving integration read service from plugin context.
|
|
1186
1186
|
*/ const INTEGRATION_PERMISSION_SERVICE_TOKEN = 'XPERT_PLUGIN_INTEGRATION_PERMISSION_SERVICE';
|
|
1187
1187
|
|
|
1188
|
-
/**
|
|
1189
|
-
* System token for resolving analytics permission service from plugin context.
|
|
1190
|
-
*/ const ANALYTICS_PERMISSION_SERVICE_TOKEN = 'XPERT_PLUGIN_ANALYTICS_PERMISSION_SERVICE';
|
|
1191
|
-
|
|
1192
1188
|
const PERMISSION_OPERATION_METADATA_KEY = 'XPERT_PLUGIN_PERMISSION_OPERATION';
|
|
1193
1189
|
function RequirePermissionOperation(permissionType, operation) {
|
|
1194
1190
|
return (_target, _propertyKey, descriptor)=>{
|
|
@@ -1246,6 +1242,14 @@ function getRequiredPermissionOperation(method, permissionType) {
|
|
|
1246
1242
|
* Internal system token used by core to expose the speech-to-text bridge.
|
|
1247
1243
|
*/ const SPEECH_TO_TEXT_SERVICE_TOKEN = 'XPERT_SPEECH_TO_TEXT_SERVICE';
|
|
1248
1244
|
|
|
1245
|
+
const VIDEO_GENERATOR_FAMILIES = [
|
|
1246
|
+
'seedance',
|
|
1247
|
+
'veo',
|
|
1248
|
+
'kling'
|
|
1249
|
+
];
|
|
1250
|
+
const VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN = 'XPERT_PLUGIN_VIDEO_GENERATION_PERMISSION_SERVICE';
|
|
1251
|
+
const VIDEO_GENERATION_SERVICE_TOKEN = 'XPERT_VIDEO_GENERATION_SERVICE';
|
|
1252
|
+
|
|
1249
1253
|
async function createI18nInstance(pluginDir, language) {
|
|
1250
1254
|
const instance = createInstance();
|
|
1251
1255
|
const i18nDir = path__default.join(pluginDir, 'i18n');
|
|
@@ -2423,17 +2427,15 @@ class LargeLanguageModel extends AIModel {
|
|
|
2423
2427
|
this.startedAt = performance.now();
|
|
2424
2428
|
},
|
|
2425
2429
|
handleLLMEnd: (output)=>{
|
|
2426
|
-
|
|
2427
|
-
var _output_llmOutput_tokenUsage, _ref;
|
|
2428
|
-
const tokenUsage = (_ref = (_output_llmOutput_tokenUsage = (_output_llmOutput = output.llmOutput) == null ? void 0 : _output_llmOutput.tokenUsage) != null ? _output_llmOutput_tokenUsage : (_output_llmOutput1 = output.llmOutput) == null ? void 0 : _output_llmOutput1.estimatedTokenUsage) != null ? _ref : calcTokenUsage(output);
|
|
2430
|
+
const tokenUsage = resolveTokenUsage(output);
|
|
2429
2431
|
if (handleLLMTokens) {
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
+
const usage = this.calcResponseUsage(model, credentials, tokenUsage.promptTokens, tokenUsage.completionTokens);
|
|
2433
|
+
usage.totalTokens = tokenUsage.totalTokens;
|
|
2432
2434
|
handleLLMTokens({
|
|
2433
2435
|
copilot,
|
|
2434
2436
|
model,
|
|
2435
|
-
usage
|
|
2436
|
-
tokenUsed:
|
|
2437
|
+
usage,
|
|
2438
|
+
tokenUsed: tokenUsage.totalTokens
|
|
2437
2439
|
});
|
|
2438
2440
|
}
|
|
2439
2441
|
}
|
|
@@ -2593,6 +2595,41 @@ function calcTokenUsage(output) {
|
|
|
2593
2595
|
});
|
|
2594
2596
|
return tokenUsage;
|
|
2595
2597
|
}
|
|
2598
|
+
function resolveTokenUsage(output) {
|
|
2599
|
+
var _output_llmOutput, _output_llmOutput1, _output_llmOutput2;
|
|
2600
|
+
var _normalizeTokenUsage, _ref, _ref1, _ref2;
|
|
2601
|
+
return (_ref2 = (_ref1 = (_ref = (_normalizeTokenUsage = normalizeTokenUsage(calcTokenUsage(output))) != null ? _normalizeTokenUsage : normalizeTokenUsage((_output_llmOutput = output.llmOutput) == null ? void 0 : _output_llmOutput['tokenUsage'])) != null ? _ref : normalizeTokenUsage((_output_llmOutput1 = output.llmOutput) == null ? void 0 : _output_llmOutput1['estimatedTokenUsage'])) != null ? _ref1 : normalizeTokenUsage({
|
|
2602
|
+
totalTokens: (_output_llmOutput2 = output.llmOutput) == null ? void 0 : _output_llmOutput2['totalTokens']
|
|
2603
|
+
})) != null ? _ref2 : {
|
|
2604
|
+
promptTokens: 0,
|
|
2605
|
+
completionTokens: 0,
|
|
2606
|
+
totalTokens: 0
|
|
2607
|
+
};
|
|
2608
|
+
}
|
|
2609
|
+
function normalizeTokenUsage(candidate) {
|
|
2610
|
+
if (!candidate) {
|
|
2611
|
+
return null;
|
|
2612
|
+
}
|
|
2613
|
+
if (!isValidTokenCount(candidate.promptTokens) || !isValidTokenCount(candidate.completionTokens) || !isValidTokenCount(candidate.totalTokens)) {
|
|
2614
|
+
return null;
|
|
2615
|
+
}
|
|
2616
|
+
var _candidate_promptTokens;
|
|
2617
|
+
const promptTokens = (_candidate_promptTokens = candidate.promptTokens) != null ? _candidate_promptTokens : 0;
|
|
2618
|
+
var _candidate_completionTokens;
|
|
2619
|
+
const completionTokens = (_candidate_completionTokens = candidate.completionTokens) != null ? _candidate_completionTokens : 0;
|
|
2620
|
+
const totalTokens = candidate.totalTokens || promptTokens + completionTokens;
|
|
2621
|
+
if (promptTokens === 0 && completionTokens === 0 && totalTokens === 0) {
|
|
2622
|
+
return null;
|
|
2623
|
+
}
|
|
2624
|
+
return {
|
|
2625
|
+
promptTokens,
|
|
2626
|
+
completionTokens,
|
|
2627
|
+
totalTokens
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
function isValidTokenCount(value) {
|
|
2631
|
+
return value === undefined || Number.isFinite(value) && value >= 0;
|
|
2632
|
+
}
|
|
2596
2633
|
/**
|
|
2597
2634
|
* @deprecated use calcTokenUsage
|
|
2598
2635
|
*/ function sumTokenUsage(output) {
|
|
@@ -2624,7 +2661,12 @@ function calcTokenUsage(output) {
|
|
|
2624
2661
|
*
|
|
2625
2662
|
*/ _convertCompletionsDeltaToBaseMessageChunk(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2626
2663
|
delta, rawResponse, defaultRole) {
|
|
2627
|
-
|
|
2664
|
+
// Some OpenAI-compatible providers omit `delta.role` on the final usage
|
|
2665
|
+
// chunk. Without a role, LangChain creates a generic ChatMessageChunk;
|
|
2666
|
+
// persisting that chunk makes the next request contain `role: undefined`.
|
|
2667
|
+
// Treat role-less completion deltas as assistant output so they remain
|
|
2668
|
+
// valid both in the current stream and when the conversation is resumed.
|
|
2669
|
+
const messageChunk = super._convertCompletionsDeltaToBaseMessageChunk(delta, rawResponse, defaultRole != null ? defaultRole : 'assistant');
|
|
2628
2670
|
if (delta['content'] === '<think>') {
|
|
2629
2671
|
this.thinking = true;
|
|
2630
2672
|
messageChunk.content = '';
|
|
@@ -2640,7 +2682,14 @@ function calcTokenUsage(output) {
|
|
|
2640
2682
|
return messageChunk;
|
|
2641
2683
|
}
|
|
2642
2684
|
_convertCompletionsMessageToBaseMessage(message, rawResponse) {
|
|
2643
|
-
|
|
2685
|
+
var _message_role;
|
|
2686
|
+
// Some compatible providers also omit the role on non-stream responses.
|
|
2687
|
+
// Normalize that response before LangChain falls back to a generic
|
|
2688
|
+
// message with role `unknown`.
|
|
2689
|
+
const normalizedMessage = _extends({}, message, {
|
|
2690
|
+
role: (_message_role = message.role) != null ? _message_role : 'assistant'
|
|
2691
|
+
});
|
|
2692
|
+
const langChainMessage = super._convertCompletionsMessageToBaseMessage(normalizedMessage, rawResponse);
|
|
2644
2693
|
console.log(langChainMessage.content);
|
|
2645
2694
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2646
2695
|
if (message.reasoning_content) {
|
|
@@ -2833,6 +2882,10 @@ const KnowledgebaseDocumentsRuntimeCapability = createRuntimeCapability('platfor
|
|
|
2833
2882
|
description: 'Upload, import, create, process, inspect, and delete persistent knowledgebase documents.'
|
|
2834
2883
|
});
|
|
2835
2884
|
|
|
2885
|
+
const ActorTokenRuntimeCapability = createRuntimeCapability('platform.actor-token', {
|
|
2886
|
+
description: 'Mint a short-lived host-issued actor bearer token for outbound API calls.'
|
|
2887
|
+
});
|
|
2888
|
+
|
|
2836
2889
|
const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts', {
|
|
2837
2890
|
description: 'Create, version, preview, download, share, archive, and delete platform-managed plugin and Agent artifacts.'
|
|
2838
2891
|
});
|
|
@@ -4457,16 +4510,31 @@ const XPERT_REMOTE_UI_CSS = `
|
|
|
4457
4510
|
--xui-color-foreground: #18181b;
|
|
4458
4511
|
--xui-color-card: #fff;
|
|
4459
4512
|
--xui-color-card-foreground: #18181b;
|
|
4513
|
+
--xui-color-popover: var(--xui-color-card);
|
|
4514
|
+
--xui-color-popover-foreground: var(--xui-color-card-foreground);
|
|
4515
|
+
--xui-color-secondary: #f4f4f5;
|
|
4516
|
+
--xui-color-secondary-foreground: #18181b;
|
|
4460
4517
|
--xui-color-muted: #f4f4f5;
|
|
4461
4518
|
--xui-color-muted-foreground: #71717a;
|
|
4519
|
+
--xui-color-accent: #f4f4f5;
|
|
4520
|
+
--xui-color-accent-foreground: #18181b;
|
|
4462
4521
|
--xui-color-border: #e4e4e7;
|
|
4463
4522
|
--xui-color-input: #d4d4d8;
|
|
4464
4523
|
--xui-color-primary: #18181b;
|
|
4465
4524
|
--xui-color-primary-foreground: #fff;
|
|
4525
|
+
--xui-color-ring: var(--xui-color-primary);
|
|
4466
4526
|
--xui-color-destructive: #dc2626;
|
|
4527
|
+
--xui-color-destructive-foreground: #fff;
|
|
4467
4528
|
--xui-color-destructive-background: #fef2f2;
|
|
4468
4529
|
--xui-color-success: #047857;
|
|
4469
4530
|
--xui-color-success-background: #ecfdf5;
|
|
4531
|
+
--xui-color-warning: #b45309;
|
|
4532
|
+
--xui-color-info: #2563eb;
|
|
4533
|
+
--xui-color-chart-1: var(--xui-color-primary);
|
|
4534
|
+
--xui-color-chart-2: var(--xui-color-success);
|
|
4535
|
+
--xui-color-chart-3: var(--xui-color-warning);
|
|
4536
|
+
--xui-color-chart-4: var(--xui-color-destructive);
|
|
4537
|
+
--xui-color-chart-5: #7c3aed;
|
|
4470
4538
|
--xui-radius-sm: 6px;
|
|
4471
4539
|
--xui-radius-md: 8px;
|
|
4472
4540
|
--xui-radius-lg: 10px;
|
|
@@ -4761,16 +4829,31 @@ const XPERT_REMOTE_UI_BOOTSTRAP = `
|
|
|
4761
4829
|
colorForeground: '--xui-color-foreground',
|
|
4762
4830
|
colorCard: '--xui-color-card',
|
|
4763
4831
|
colorCardForeground: '--xui-color-card-foreground',
|
|
4832
|
+
colorPopover: '--xui-color-popover',
|
|
4833
|
+
colorPopoverForeground: '--xui-color-popover-foreground',
|
|
4834
|
+
colorSecondary: '--xui-color-secondary',
|
|
4835
|
+
colorSecondaryForeground: '--xui-color-secondary-foreground',
|
|
4764
4836
|
colorMuted: '--xui-color-muted',
|
|
4765
4837
|
colorMutedForeground: '--xui-color-muted-foreground',
|
|
4838
|
+
colorAccent: '--xui-color-accent',
|
|
4839
|
+
colorAccentForeground: '--xui-color-accent-foreground',
|
|
4766
4840
|
colorBorder: '--xui-color-border',
|
|
4767
4841
|
colorInput: '--xui-color-input',
|
|
4768
4842
|
colorPrimary: '--xui-color-primary',
|
|
4769
4843
|
colorPrimaryForeground: '--xui-color-primary-foreground',
|
|
4844
|
+
colorRing: '--xui-color-ring',
|
|
4770
4845
|
colorDestructive: '--xui-color-destructive',
|
|
4846
|
+
colorDestructiveForeground: '--xui-color-destructive-foreground',
|
|
4771
4847
|
colorDestructiveBackground: '--xui-color-destructive-background',
|
|
4772
4848
|
colorSuccess: '--xui-color-success',
|
|
4773
4849
|
colorSuccessBackground: '--xui-color-success-background',
|
|
4850
|
+
colorWarning: '--xui-color-warning',
|
|
4851
|
+
colorInfo: '--xui-color-info',
|
|
4852
|
+
colorChart1: '--xui-color-chart-1',
|
|
4853
|
+
colorChart2: '--xui-color-chart-2',
|
|
4854
|
+
colorChart3: '--xui-color-chart-3',
|
|
4855
|
+
colorChart4: '--xui-color-chart-4',
|
|
4856
|
+
colorChart5: '--xui-color-chart-5',
|
|
4774
4857
|
radiusSm: '--xui-radius-sm',
|
|
4775
4858
|
radiusMd: '--xui-radius-md',
|
|
4776
4859
|
radiusLg: '--xui-radius-lg',
|
|
@@ -4915,4 +4998,4 @@ CollaborationDocumentProviderRegistry = __decorate([
|
|
|
4915
4998
|
])
|
|
4916
4999
|
], CollaborationDocumentProviderRegistry);
|
|
4917
5000
|
|
|
4918
|
-
export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER,
|
|
5001
|
+
export { ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN, AGENT_CHAT_DISPATCH_ERROR_STEER_TARGET_NOT_RUNNING, AGENT_CHAT_DISPATCH_MESSAGE_TYPE, AGENT_MIDDLEWARE_STRATEGY, AIModelProviderNotFoundException, AIModelProviderRegistry, AIModelProviderStrategy, AI_MODEL_PROVIDER, ActorTokenRuntimeCapability, AdapterDataSourceStrategy, AgentMiddlewareRegistry, AgentMiddlewareStrategy, AiModelNotFoundException, ArtifactsRuntimeCapability, AssistantTaskRuntimeCapability, BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN, BUILTIN_GLOBAL_SCOPE, BaseHTTPQueryRunner, BaseQueryRunner, BaseSQLQueryRunner, BaseSandbox, BaseStrategyRegistry, BaseTool, BaseToolset, BuiltinToolset, CHAT_CHANNEL, CHAT_CHANNEL_TEXT_LIMITS, COLLABORATION_DOCUMENT_PROVIDER, CONNECTION_COMMAND_ROUTER_TOKEN, CONNECTOR_STRATEGY, CancelConversationCommand, ChatChannel, ChatChannelRegistry, ChatOAICompatReasoningModel, CollaborationDocumentProvider, CollaborationDocumentProviderRegistry, CollaborationRuntimeCapability, CommonParameterRules, ConnectorRuntimeCapability, ConnectorStrategyKey, ConnectorStrategyRegistry, CreateModelClientCommand, CredentialsValidateFailedError, DATASOURCE_STRATEGY, DBCreateTableMode, DBProtocolEnum, DBSyntaxEnum, DBTableAction, DBTableDataAction, DEFAULT_EXECUTION_CONFIG, DEFAULT_SANDBOX_EXECUTION_MAX_OUTPUT_BYTES, DEFAULT_SANDBOX_FILE_OPERATION_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_OPERATION_TIMEOUT_SEC, DEFAULT_SANDBOX_FILE_SEARCH_EXECUTION_OPTIONS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_MS, DEFAULT_SANDBOX_FILE_SEARCH_TIMEOUT_SEC, DEFAULT_SANDBOX_SHELL_EXECUTION_OPTIONS, DEFAULT_SANDBOX_SHELL_TIMEOUT_MS, DEFAULT_SANDBOX_SHELL_TIMEOUT_SEC, DOCUMENT_SOURCE_STRATEGY, DOCUMENT_TRANSFORMER_STRATEGY, DataSourceStrategy, DataSourceStrategyRegistry, DefaultRuntimeCapabilityRegistry as DefaultAgentMiddlewareRuntimeCapabilityRegistry, DefaultRuntimeCapabilityRegistry, DocumentSourceRegistry, DocumentSourceStrategy, DocumentTransformerRegistry, DocumentTransformerStrategy, FILE_STORAGE_PROVIDER, FILE_UPLOAD_TARGET_STRATEGY, FileRuntimeCapability, FileStorageProvider, FileStorageProviderRegistry, FileUploadTargetRegistry, FileUploadTargetStrategy, GLOBAL_ORGANIZATION_SCOPE, HANDOFF_PERMISSION_SERVICE_TOKEN, HANDOFF_PROCESSOR_STRATEGY, HANDOFF_QUEUE_SERVICE_TOKEN, HandoffProcessorRegistry, HandoffProcessorStrategy, IMAGE_UNDERSTANDING_STRATEGY, INTEGRATION_PERMISSION_SERVICE_TOKEN, INTEGRATION_STRATEGY, ImageUnderstandingRegistry, ImageUnderstandingStrategy, IntegrationStrategyKey, IntegrationStrategyRegistry, JUMP_TO_TARGETS, JsonSchemaValidator, KNOWLEDGE_STRATEGY, KnowledgeStrategyKey, KnowledgeStrategyRegistry, KnowledgebaseDocumentsRuntimeCapability, KnowledgebaseRuntimeCapability, LLMUsage, LargeLanguageModel, MANAGED_CONNECTION_REGISTRY_TOKEN, MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN, MANAGED_QUEUE_SERVICE_TOKEN, ModelProvider, ORGANIZATION_METADATA_KEY, OpenAICompatibleReranker, PERMISSION_OPERATION_METADATA_KEY, PLUGIN_CONFIG_RESOLVER_TOKEN, PLUGIN_JOB_PROCESSOR_METADATA, PLUGIN_METADATA, PLUGIN_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_METADATA_KEY, PLUGIN_WEBHOOK_AUTH_SERVICE_TOKEN, PROVIDE_AI_MODEL_LLM, PROVIDE_AI_MODEL_MODERATION, PROVIDE_AI_MODEL_RERANK, PROVIDE_AI_MODEL_SPEECH2TEXT, PROVIDE_AI_MODEL_TEXT_EMBEDDING, PROVIDE_AI_MODEL_TTS, PluginJobProcessor, PluginWebhookAuth, PluginWebhookAuthGuard, RETRIEVER_STRATEGY, RequestContext, RequestContextMiddleware, RequirePermissionOperation, RerankModel, RetrieverRegistry, RetrieverStrategy, SANDBOX_JOB_ERROR_CODES, SANDBOX_JOB_PROGRESS_PREFIX, SANDBOX_PROVIDER, SANDBOX_RUNTIME_PROVIDER, SANDBOX_SHELL_TIMEOUT_LIMITS_SEC, SANDBOX_WORKSPACE_MAPPER, SKILL_SOURCE_PROVIDER, SPEECH_TO_TEXT_PERMISSION_SERVICE_TOKEN, SPEECH_TO_TEXT_SERVICE_TOKEN, SSOProviderRegistry, SSOProviderStrategyKey, SSO_BINDING_PERMISSION_SERVICE_TOKEN, SSO_PROVIDER, STRATEGY_META_KEY, SYSTEM_GLOBAL_SCOPE, SandboxJobRuntimeError, SandboxJobsRuntimeCapability, SandboxProviderRegistry, SandboxProviderStrategy, SandboxRuntimeProviderRegistry, SandboxRuntimeProviderStrategy, SandboxWorkspaceMapperRegistry, SandboxWorkspaceMapperStrategy, SkillSourceProviderRegistry, SkillSourceProviderStrategy, Speech2TextChatModel, SpeechToTextModel, StrategyBus, TENANT_GLOBAL_SCOPE_PREFIX, TENANT_GLOBAL_SCOPE_SUFFIX, TEXT_SPLITTER_STRATEGY, TOOLSET_STRATEGY, TextEmbeddingModelManager, TextSplitterRegistry, TextSplitterStrategy, TextToSpeechModel, ToolsetRegistry, ToolsetStrategy, USER_PERMISSION_SERVICE_TOKEN, VECTOR_STORE_STRATEGY, VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN, VIDEO_GENERATION_SERVICE_TOKEN, VIDEO_GENERATOR_FAMILIES, VIEW_EXTENSION_CACHE_SERVICE_TOKEN, VIEW_EXTENSION_PROVIDER, VectorStoreRegistry, VectorStoreStrategy, ViewExtensionProvider, ViewExtensionProviderRegistry, WORKFLOW_NODE_STRATEGY, WORKFLOW_TRIGGER_STRATEGY, WORKSPACE_FILES_SOURCE, WorkflowNodeRegistry, WorkflowNodeStrategy, WorkflowTriggerRegistry, WorkflowTriggerStrategy, WorkspaceFilesRuntimeCapability, WrapWorkflowNodeExecutionCommand, XPERT_RUNTIME_CAPABILITIES_TOKEN, XpFileSystem, XpertServerPlugin, als, appendSandboxMessage, assertConnectorDefinition, buildSandboxTimeoutMessage, calcTokenUsage, calculateModelPrice, chunkText, countTokensSafe, createI18nInstance, createPluginLogger, createRuntimeCapability, defineAgentMessageType, defineChannelMessageType, derivePluginArtifactNamespace, downloadRemoteFile, formatSandboxTimeout, getDefaultTenantId, getErrorMessage, getModelContextSize, getPermissionOperationMetadata, getPositionList, getPositionMap, getRequestContext, getRequiredPermissionOperation, getTenantGlobalScopeKey, isDevelopmentSandboxRuntimeEnvironment, isRemoteFile, isSandboxBackend, isSandboxJobRuntimeError, isSandboxManagedServiceAdapter, isSandboxServiceProxyAdapter, isSandboxTerminalAdapter, isStrategyInstance, isStructuredMessageType, isTenantGlobalScopeKey, loadYamlFile, mergeCredentials, mergeParentChildChunks, normalizeContextSize, pluginArtifactTableName, renderRemoteModuleIframeHtml, renderRemoteReactIframeHtml, renderRemoteVueIframeHtml, resolveSandboxBackend, resolveSandboxExecutionOptions, resolveSandboxManagedServiceAdapter, resolveSandboxServiceProxyAdapter, resolveSandboxTerminalAdapter, resolveStrategyMetadataTarget, resolveTenantGlobalScopeKey, resolveTokenUsage, runWithRequestContext, secondsToMilliseconds, setDefaultTenantId, sumTokenUsage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/plugin-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.1",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@langchain/openai": "0.6.9",
|
|
20
|
-
"@xpert-ai/contracts": "3.
|
|
20
|
+
"@xpert-ai/contracts": "3.16.0",
|
|
21
21
|
"express": "^4.22.1",
|
|
22
22
|
"js-tiktoken": "^1.0.21"
|
|
23
23
|
},
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"@nestjs/common": "*",
|
|
27
27
|
"@nestjs/core": "*",
|
|
28
28
|
"@nestjs/cqrs": "*",
|
|
29
|
-
"@xpert-ai/ocap-core": "3.9.1",
|
|
30
29
|
"ajv": "*",
|
|
31
30
|
"i18next": "*",
|
|
32
31
|
"i18next-fs-backend": "*",
|
|
@@ -52,6 +52,7 @@ export declare abstract class LargeLanguageModel extends AIModel {
|
|
|
52
52
|
private formatError;
|
|
53
53
|
}
|
|
54
54
|
export declare function calcTokenUsage(output: LLMResult): TTokenUsage;
|
|
55
|
+
export declare function resolveTokenUsage(output: LLMResult): TTokenUsage;
|
|
55
56
|
/**
|
|
56
57
|
* @deprecated use calcTokenUsage
|
|
57
58
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IssuedAuthTokens } from './auth-login';
|
|
2
2
|
import type { BasePermission } from './general';
|
|
3
|
-
export type BoundIdentityLoginPermissionOperation = 'create';
|
|
3
|
+
export type BoundIdentityLoginPermissionOperation = 'create' | 'provision';
|
|
4
4
|
/**
|
|
5
5
|
* Bound identity login permission
|
|
6
6
|
* Example: { type: 'bound_identity_login', operations: ['create'], providers: ['lark'] }
|
|
@@ -20,6 +20,24 @@ export interface BoundIdentityLoginInput {
|
|
|
20
20
|
tenantId: string;
|
|
21
21
|
organizationId?: string | null;
|
|
22
22
|
}
|
|
23
|
+
export interface VerifiedEmailLoginInput {
|
|
24
|
+
provider: string;
|
|
25
|
+
subjectId: string;
|
|
26
|
+
tenantId: string;
|
|
27
|
+
verifiedEmail: string;
|
|
28
|
+
displayName?: string;
|
|
29
|
+
avatarUrl?: string;
|
|
30
|
+
profile?: Record<string, unknown>;
|
|
31
|
+
returnTo?: string;
|
|
32
|
+
}
|
|
33
|
+
export type VerifiedEmailLoginResult = {
|
|
34
|
+
status: 'authenticated';
|
|
35
|
+
tokens: IssuedAuthTokens;
|
|
36
|
+
} | {
|
|
37
|
+
status: 'registration_required';
|
|
38
|
+
ticket: string;
|
|
39
|
+
};
|
|
23
40
|
export interface BoundIdentityLoginPermissionService {
|
|
24
41
|
loginWithBoundIdentity(input: BoundIdentityLoginInput): Promise<IssuedAuthTokens | null>;
|
|
42
|
+
loginOrPrepareVerifiedEmail(input: VerifiedEmailLoginInput): Promise<VerifiedEmailLoginResult>;
|
|
25
43
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* Core system will check and inject allowed resources accordingly.
|
|
7
7
|
*/
|
|
8
8
|
export * from './general';
|
|
9
|
-
export * from './analytics';
|
|
10
9
|
export * from './operation';
|
|
11
10
|
export * from './handoff';
|
|
12
11
|
export * from './account-binding';
|
|
@@ -15,18 +14,19 @@ export * from './bound-identity-login';
|
|
|
15
14
|
export * from './sso-binding';
|
|
16
15
|
export * from './user';
|
|
17
16
|
export * from './speech-to-text';
|
|
17
|
+
export * from './video-generation';
|
|
18
18
|
import type { FileSystemPermission, IntegrationPermission, KnowledgePermission, LLMPermission, VectorStorePermission } from './general';
|
|
19
|
-
import type { AnalyticsPermission } from './analytics';
|
|
20
19
|
import type { AccountBindingPermission } from './account-binding';
|
|
21
20
|
import type { BoundIdentityLoginPermission } from './bound-identity-login';
|
|
22
21
|
import type { HandoffPermission } from './handoff';
|
|
23
22
|
import type { SpeechToTextPermission } from './speech-to-text';
|
|
24
23
|
import type { SsoBindingPermission } from './sso-binding';
|
|
25
24
|
import type { UserPermission } from './user';
|
|
25
|
+
import type { VideoGenerationPermission } from './video-generation';
|
|
26
26
|
/**
|
|
27
27
|
* Union type for all permissions
|
|
28
28
|
*/
|
|
29
|
-
export type Permission = LLMPermission | VectorStorePermission | KnowledgePermission | FileSystemPermission | IntegrationPermission |
|
|
29
|
+
export type Permission = LLMPermission | VectorStorePermission | KnowledgePermission | FileSystemPermission | IntegrationPermission | AccountBindingPermission | BoundIdentityLoginPermission | SsoBindingPermission | UserPermission | HandoffPermission | SpeechToTextPermission | VideoGenerationPermission;
|
|
30
30
|
/**
|
|
31
31
|
* Permissions array type
|
|
32
32
|
*/
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { WorkspacePortableFileReference } from '../../runtime/capabilities/workspace-files';
|
|
2
|
+
export declare const VIDEO_GENERATOR_FAMILIES: readonly ["seedance", "veo", "kling"];
|
|
3
|
+
export type VideoGeneratorFamily = (typeof VIDEO_GENERATOR_FAMILIES)[number];
|
|
4
|
+
export type VideoGenerationPermissionOperation = 'list' | 'submit' | 'query' | 'cancel';
|
|
5
|
+
export type VideoGenerationMode = 'text_to_video' | 'image_to_video' | 'first_last_frame_to_video' | 'reference_to_video';
|
|
6
|
+
export type VideoGenerationReferenceKind = 'image' | 'video' | 'audio';
|
|
7
|
+
export type VideoGenerationReferencePurpose = 'reference' | 'first_frame' | 'last_frame';
|
|
8
|
+
export interface VideoGenerationPermission {
|
|
9
|
+
type: 'video_generation';
|
|
10
|
+
operations?: VideoGenerationPermissionOperation[];
|
|
11
|
+
scope?: string[];
|
|
12
|
+
description?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const VIDEO_GENERATION_PERMISSION_SERVICE_TOKEN = "XPERT_PLUGIN_VIDEO_GENERATION_PERMISSION_SERVICE";
|
|
15
|
+
export declare const VIDEO_GENERATION_SERVICE_TOKEN = "XPERT_VIDEO_GENERATION_SERVICE";
|
|
16
|
+
export interface VideoGenerationReferenceLimit {
|
|
17
|
+
maxItems: number;
|
|
18
|
+
}
|
|
19
|
+
export interface VideoGenerationModelInputCapabilities {
|
|
20
|
+
referenceImages?: VideoGenerationReferenceLimit;
|
|
21
|
+
referenceVideos?: VideoGenerationReferenceLimit;
|
|
22
|
+
referenceAudios?: VideoGenerationReferenceLimit;
|
|
23
|
+
initialFrame?: boolean;
|
|
24
|
+
lastFrame?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface VideoGenerationModelOption {
|
|
27
|
+
id: string;
|
|
28
|
+
label: string;
|
|
29
|
+
/** Optional per-model restriction. Defaults to the generator-level modes. */
|
|
30
|
+
modes?: readonly VideoGenerationMode[];
|
|
31
|
+
inputs?: VideoGenerationModelInputCapabilities;
|
|
32
|
+
}
|
|
33
|
+
interface VideoGenerationToolsetCapabilityBase {
|
|
34
|
+
family: VideoGeneratorFamily;
|
|
35
|
+
displayName: string;
|
|
36
|
+
modes: readonly VideoGenerationMode[];
|
|
37
|
+
models: readonly VideoGenerationModelOption[];
|
|
38
|
+
defaultModel: string;
|
|
39
|
+
resolutions: readonly string[];
|
|
40
|
+
aspectRatios: readonly string[];
|
|
41
|
+
durationSeconds: {
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
default: number;
|
|
45
|
+
};
|
|
46
|
+
supportsAudio: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** Legacy single-image protocol. Kept so already installed provider plugins remain usable. */
|
|
49
|
+
export interface VideoGenerationToolsetCapabilityV1 extends VideoGenerationToolsetCapabilityBase {
|
|
50
|
+
protocolVersion: 1;
|
|
51
|
+
tools: {
|
|
52
|
+
textToVideo?: string;
|
|
53
|
+
imageToVideo?: string;
|
|
54
|
+
query: string;
|
|
55
|
+
cancel?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Capability-driven protocol. Submit tools consume normalized argument names:
|
|
60
|
+
* `input_image_file`, `first_frame_file`, `last_frame_file`, and
|
|
61
|
+
* `reference_{image,video,audio}_files`.
|
|
62
|
+
*/
|
|
63
|
+
export interface VideoGenerationToolsetCapabilityV2 extends VideoGenerationToolsetCapabilityBase {
|
|
64
|
+
protocolVersion: 2;
|
|
65
|
+
tools: {
|
|
66
|
+
textToVideo?: string;
|
|
67
|
+
imageToVideo?: string;
|
|
68
|
+
firstLastFrameToVideo?: string;
|
|
69
|
+
referenceToVideo?: string;
|
|
70
|
+
query: string;
|
|
71
|
+
cancel?: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export type VideoGenerationToolsetCapability = VideoGenerationToolsetCapabilityV1 | VideoGenerationToolsetCapabilityV2;
|
|
75
|
+
export interface VideoGeneratorSummary {
|
|
76
|
+
id: string;
|
|
77
|
+
family: VideoGeneratorFamily;
|
|
78
|
+
name: string;
|
|
79
|
+
displayName: string;
|
|
80
|
+
linkedToXpert: boolean;
|
|
81
|
+
modes: VideoGenerationMode[];
|
|
82
|
+
models: VideoGenerationModelOption[];
|
|
83
|
+
defaultModel: string;
|
|
84
|
+
resolutions: string[];
|
|
85
|
+
aspectRatios: string[];
|
|
86
|
+
durationSeconds: {
|
|
87
|
+
min: number;
|
|
88
|
+
max: number;
|
|
89
|
+
default: number;
|
|
90
|
+
};
|
|
91
|
+
supportsAudio: boolean;
|
|
92
|
+
supportsCancel: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface ListVideoGeneratorsInput {
|
|
95
|
+
xpertId: string;
|
|
96
|
+
}
|
|
97
|
+
export interface ListVideoGeneratorsResult {
|
|
98
|
+
generators: VideoGeneratorSummary[];
|
|
99
|
+
}
|
|
100
|
+
export interface VideoGenerationReferenceInput {
|
|
101
|
+
kind: VideoGenerationReferenceKind;
|
|
102
|
+
purpose?: VideoGenerationReferencePurpose;
|
|
103
|
+
file: WorkspacePortableFileReference;
|
|
104
|
+
}
|
|
105
|
+
export interface SubmitVideoGenerationInput {
|
|
106
|
+
xpertId: string;
|
|
107
|
+
toolsetId: string;
|
|
108
|
+
projectId?: string | null;
|
|
109
|
+
prompt: string;
|
|
110
|
+
references?: readonly VideoGenerationReferenceInput[] | null;
|
|
111
|
+
/** @deprecated Use `references` with an image item. */
|
|
112
|
+
inputImage?: WorkspacePortableFileReference | null;
|
|
113
|
+
model?: string | null;
|
|
114
|
+
resolution?: string | null;
|
|
115
|
+
aspectRatio?: string | null;
|
|
116
|
+
durationSeconds?: number | null;
|
|
117
|
+
generateAudio?: boolean | null;
|
|
118
|
+
}
|
|
119
|
+
export interface SubmitVideoGenerationResult {
|
|
120
|
+
providerTaskId: string;
|
|
121
|
+
status: string;
|
|
122
|
+
model?: string;
|
|
123
|
+
mode?: VideoGenerationMode;
|
|
124
|
+
acceptedReferenceCount?: number;
|
|
125
|
+
}
|
|
126
|
+
export interface QueryVideoGenerationInput {
|
|
127
|
+
xpertId: string;
|
|
128
|
+
toolsetId: string;
|
|
129
|
+
projectId?: string | null;
|
|
130
|
+
providerTaskId: string;
|
|
131
|
+
}
|
|
132
|
+
export interface QueryVideoGenerationResult {
|
|
133
|
+
providerTaskId: string;
|
|
134
|
+
status: string;
|
|
135
|
+
completed: boolean;
|
|
136
|
+
failed: boolean;
|
|
137
|
+
model?: string;
|
|
138
|
+
errorCode?: string;
|
|
139
|
+
errorMessage?: string;
|
|
140
|
+
outputFile?: WorkspacePortableFileReference;
|
|
141
|
+
}
|
|
142
|
+
export interface CancelVideoGenerationInput {
|
|
143
|
+
xpertId: string;
|
|
144
|
+
toolsetId: string;
|
|
145
|
+
providerTaskId: string;
|
|
146
|
+
}
|
|
147
|
+
export interface CancelVideoGenerationResult {
|
|
148
|
+
providerTaskId: string;
|
|
149
|
+
supported: boolean;
|
|
150
|
+
cancelled: boolean;
|
|
151
|
+
status: string;
|
|
152
|
+
}
|
|
153
|
+
export interface VideoGenerationPermissionService {
|
|
154
|
+
listGenerators(input: ListVideoGeneratorsInput): Promise<ListVideoGeneratorsResult>;
|
|
155
|
+
submit(input: SubmitVideoGenerationInput): Promise<SubmitVideoGenerationResult>;
|
|
156
|
+
query(input: QueryVideoGenerationInput): Promise<QueryVideoGenerationResult>;
|
|
157
|
+
cancel(input: CancelVideoGenerationInput): Promise<CancelVideoGenerationResult>;
|
|
158
|
+
}
|
|
159
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ActorTokenAct = Record<string, string | number | boolean | null | undefined>;
|
|
2
|
+
export interface ActorTokenRequest {
|
|
3
|
+
audience?: string | string[];
|
|
4
|
+
ttlSeconds?: number;
|
|
5
|
+
act?: ActorTokenAct;
|
|
6
|
+
}
|
|
7
|
+
export interface ActorTokenResult {
|
|
8
|
+
token: string;
|
|
9
|
+
expiresAt: string;
|
|
10
|
+
audience: string | string[];
|
|
11
|
+
}
|
|
12
|
+
export interface ActorTokenApi {
|
|
13
|
+
getToken(input?: ActorTokenRequest): Promise<ActorTokenResult>;
|
|
14
|
+
}
|
|
15
|
+
export declare const ActorTokenRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ActorTokenApi>;
|
|
@@ -10,6 +10,7 @@ export declare const WORKSPACE_FILES_SOURCE: "platform.workspace.files";
|
|
|
10
10
|
*/
|
|
11
11
|
export type WorkspaceFileScope = {
|
|
12
12
|
tenantId?: string | null;
|
|
13
|
+
organizationId?: string | null;
|
|
13
14
|
userId?: string | null;
|
|
14
15
|
catalog?: WorkspaceFileCatalog | null;
|
|
15
16
|
scopeId?: string | null;
|
|
@@ -151,6 +152,38 @@ export type WorkspaceUnderstoodFile = WorkspaceFile & {
|
|
|
151
152
|
capabilities?: string[];
|
|
152
153
|
summary?: string;
|
|
153
154
|
};
|
|
155
|
+
export type WorkspaceUnderstandingVectorStatus = 'pending' | 'ready' | 'failed' | 'unavailable';
|
|
156
|
+
export type WorkspaceUnderstandingStatusInput = WorkspaceFileScope & {
|
|
157
|
+
fileAssetId: string;
|
|
158
|
+
};
|
|
159
|
+
/** Compact readiness DTO for an understood file. It never contains parsed text. */
|
|
160
|
+
export type WorkspaceUnderstandingStatus = {
|
|
161
|
+
fileAssetId: string;
|
|
162
|
+
status: string;
|
|
163
|
+
parseMode: string;
|
|
164
|
+
capabilities: string[];
|
|
165
|
+
chunkCount: number;
|
|
166
|
+
indexedChunkCount: number;
|
|
167
|
+
vectorIndexStatus: WorkspaceUnderstandingVectorStatus;
|
|
168
|
+
errorCode?: string;
|
|
169
|
+
parsedAt?: string;
|
|
170
|
+
};
|
|
171
|
+
export type WorkspaceRetryUnderstandingInput = WorkspaceUnderstandingStatusInput;
|
|
172
|
+
export type WorkspaceUnderstandingReferenceInput = {
|
|
173
|
+
fileAssetId: string;
|
|
174
|
+
chunkId: string;
|
|
175
|
+
};
|
|
176
|
+
export type WorkspaceValidateUnderstandingReferencesInput = WorkspaceFileScope & {
|
|
177
|
+
references: WorkspaceUnderstandingReferenceInput[];
|
|
178
|
+
excerptLength?: number;
|
|
179
|
+
};
|
|
180
|
+
export type WorkspaceValidatedUnderstandingReference = {
|
|
181
|
+
fileAssetId: string;
|
|
182
|
+
chunkId: string;
|
|
183
|
+
orderNo: number;
|
|
184
|
+
anchor?: Record<string, unknown>;
|
|
185
|
+
excerpt: string;
|
|
186
|
+
};
|
|
154
187
|
/**
|
|
155
188
|
* Runtime capability contract for reading, writing, uploading, deleting, and
|
|
156
189
|
* understanding files in Xpert workspace Volumes.
|
|
@@ -160,6 +193,12 @@ export interface WorkspaceFilesApi {
|
|
|
160
193
|
uploadBuffer(input: WorkspaceUploadBufferInput): Promise<WorkspaceFile>;
|
|
161
194
|
/** Register an existing workspace file with the platform understanding pipeline. */
|
|
162
195
|
understandFile(input: WorkspaceUnderstandFileInput): Promise<WorkspaceUnderstoodFile>;
|
|
196
|
+
/** Return compact parsing and semantic-index readiness for one scoped FileAsset. */
|
|
197
|
+
getUnderstandingStatus(input: WorkspaceUnderstandingStatusInput): Promise<WorkspaceUnderstandingStatus>;
|
|
198
|
+
/** Retry parsing and semantic indexing for one failed scoped FileAsset. */
|
|
199
|
+
retryUnderstanding(input: WorkspaceRetryUnderstandingInput): Promise<WorkspaceUnderstandingStatus>;
|
|
200
|
+
/** Validate bounded FileAsset/chunk evidence without returning complete file contents. */
|
|
201
|
+
validateUnderstandingReferences(input: WorkspaceValidateUnderstandingReferencesInput): Promise<WorkspaceValidatedUnderstandingReference[]>;
|
|
163
202
|
/**
|
|
164
203
|
* Resolve metadata and an openable URL for an explicitly scoped workspace
|
|
165
204
|
* file without reading its bytes into the API process.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TSandboxProviderMeta, TSandboxWorkForType } from '@xpert-ai/contracts';
|
|
2
|
-
import { SandboxBackendProtocol } from './protocol';
|
|
2
|
+
import { MaybePromise, SandboxBackendProtocol } from './protocol';
|
|
3
3
|
export type SandboxWorkspaceBinding = {
|
|
4
4
|
/**
|
|
5
5
|
* Host-side bind source used by containerized sandboxes.
|
|
@@ -71,6 +71,11 @@ export type SandboxProviderCreateOptions = {
|
|
|
71
71
|
export interface ISandboxProvider<T extends SandboxBackendProtocol = SandboxBackendProtocol> {
|
|
72
72
|
type: string;
|
|
73
73
|
meta: TSandboxProviderMeta;
|
|
74
|
+
/**
|
|
75
|
+
* Whether this provider is currently available in this deployment.
|
|
76
|
+
* Providers without an availability hook remain available for backward compatibility.
|
|
77
|
+
*/
|
|
78
|
+
isAvailable?(): MaybePromise<boolean>;
|
|
74
79
|
/**
|
|
75
80
|
* Create a new sandbox instance
|
|
76
81
|
*
|
|
@@ -7,6 +7,8 @@ export type SandboxTerminalExit = {
|
|
|
7
7
|
export type SandboxTerminalOpenOptions = {
|
|
8
8
|
cols: number;
|
|
9
9
|
rows: number;
|
|
10
|
+
/** Reports terminal transport or provider failures separately from process exit. */
|
|
11
|
+
onError?: (error: Error) => void;
|
|
10
12
|
onExit: (event: SandboxTerminalExit) => void;
|
|
11
13
|
onOutput: (data: string) => void;
|
|
12
14
|
};
|
|
@@ -2,6 +2,7 @@ import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
|
2
2
|
import { I18nObject, IconDefinition } from '@xpert-ai/contracts';
|
|
3
3
|
import { ZodSchema } from 'zod';
|
|
4
4
|
import { BuiltinToolset, TBuiltinToolsetParams } from './builtin';
|
|
5
|
+
import type { VideoGenerationToolsetCapability } from '../core/permissions/video-generation';
|
|
5
6
|
export interface IToolsetStrategy<TConfig = any> {
|
|
6
7
|
/**
|
|
7
8
|
* Metadata about this toolset
|
|
@@ -14,6 +15,8 @@ export interface IToolsetStrategy<TConfig = any> {
|
|
|
14
15
|
description?: I18nObject;
|
|
15
16
|
configSchema: any;
|
|
16
17
|
icon?: IconDefinition;
|
|
18
|
+
/** Optional normalized video-generation capability consumed by platform services. */
|
|
19
|
+
videoGeneration?: VideoGenerationToolsetCapability;
|
|
17
20
|
};
|
|
18
21
|
/**
|
|
19
22
|
* Validate the configuration
|
package/src/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IconDefinition, JsonSchemaObjectType, PluginMeta, PluginTargetApp, PluginTargetAppMeta, TAvatar, type TPromptWorkflow, XpertTemplatePluginDependencies, XpertTypeEnum } from '@xpert-ai/contracts';
|
|
1
|
+
import { IconDefinition, I18nObject, JsonSchemaObjectType, PluginMeta, PluginTargetApp, PluginTargetAppMeta, TAvatar, type TPromptWorkflow, XpertTemplatePluginDependencies, XpertTypeEnum } from '@xpert-ai/contracts';
|
|
2
2
|
import type { DynamicModule, INestApplicationContext } from '@nestjs/common';
|
|
3
3
|
import { ModuleRef } from '@nestjs/core';
|
|
4
4
|
import type { ZodSchema } from 'zod';
|
|
@@ -60,8 +60,8 @@ export interface XpertTemplateContribution {
|
|
|
60
60
|
key: string;
|
|
61
61
|
id?: string;
|
|
62
62
|
name?: string;
|
|
63
|
-
title?: string;
|
|
64
|
-
description?: string;
|
|
63
|
+
title?: string | I18nObject;
|
|
64
|
+
description?: string | I18nObject;
|
|
65
65
|
category?: string;
|
|
66
66
|
copyright?: string | null;
|
|
67
67
|
privacyPolicy?: string | null;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { BasePermission } from './general';
|
|
2
|
-
export type AnalyticsPermissionOperation = 'dscore' | 'query' | 'model' | 'indicator' | 'create_indicator';
|
|
3
|
-
/**
|
|
4
|
-
* Analytics Permission
|
|
5
|
-
* Example: { type: 'analytics', operations: ['dscore'] }
|
|
6
|
-
*/
|
|
7
|
-
export interface AnalyticsPermission extends BasePermission {
|
|
8
|
-
type: 'analytics';
|
|
9
|
-
operations?: AnalyticsPermissionOperation[];
|
|
10
|
-
scope?: string[];
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* System token for resolving analytics permission service from plugin context.
|
|
14
|
-
*/
|
|
15
|
-
export declare const ANALYTICS_PERMISSION_SERVICE_TOKEN = "XPERT_PLUGIN_ANALYTICS_PERMISSION_SERVICE";
|
|
16
|
-
export interface AnalyticsResolvedChatBIModel {
|
|
17
|
-
chatbiModelId: string;
|
|
18
|
-
modelId: string;
|
|
19
|
-
modelKey?: string;
|
|
20
|
-
cubeName: string;
|
|
21
|
-
entityCaption?: string;
|
|
22
|
-
entityDescription?: string;
|
|
23
|
-
prompts?: string[];
|
|
24
|
-
}
|
|
25
|
-
export interface AnalyticsDSCoreInput {
|
|
26
|
-
modelIds?: string[];
|
|
27
|
-
indicatorDraft?: boolean;
|
|
28
|
-
semanticModelDraft?: boolean;
|
|
29
|
-
}
|
|
30
|
-
export interface AnalyticsIndicatorValidationInput {
|
|
31
|
-
modelIds?: string[];
|
|
32
|
-
semanticModelId: string;
|
|
33
|
-
modelKey?: string;
|
|
34
|
-
statement: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Analytics service exposed to plugins under permission control.
|
|
38
|
-
*/
|
|
39
|
-
export interface AnalyticsPermissionService<TDSCoreService = unknown> {
|
|
40
|
-
resolveChatBIModels(modelIds: string[]): Promise<AnalyticsResolvedChatBIModel[]>;
|
|
41
|
-
getDSCoreService(input?: AnalyticsDSCoreInput): Promise<TDSCoreService>;
|
|
42
|
-
visitChatBIModel(modelId: string, cubeName: string): Promise<void>;
|
|
43
|
-
ensureCreateIndicatorAccess(): Promise<void>;
|
|
44
|
-
validateIndicatorStatement(input: AnalyticsIndicatorValidationInput): Promise<void>;
|
|
45
|
-
}
|