@xpert-ai/plugin-sdk 3.9.9 → 4.0.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/CHANGELOG.md +11 -0
- package/README.md +4 -0
- package/index.cjs.js +483 -13
- package/index.esm.js +477 -14
- package/package.json +1 -1
- package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +45 -0
- package/src/lib/agent/middleware/capabilities/file.d.ts +29 -0
- package/src/lib/agent/middleware/capabilities/index.d.ts +3 -0
- package/src/lib/agent/middleware/capabilities/knowledgebase.d.ts +70 -0
- package/src/lib/agent/middleware/runtime-capability.d.ts +22 -0
- package/src/lib/agent/middleware/runtime.d.ts +26 -5
- package/src/lib/agent/middleware/strategy.interface.d.ts +2 -1
- package/src/lib/types.d.ts +33 -1
- package/src/lib/view-extension/index.d.ts +1 -0
- package/src/lib/view-extension/provider.interface.d.ts +10 -1
- package/src/lib/view-extension/remote-component-html.d.ts +9 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/index.cjs.js
CHANGED
|
@@ -359,22 +359,25 @@ class RequestContext {
|
|
|
359
359
|
*/ static hasRoles(roles, throwError) {
|
|
360
360
|
const context = RequestContext.currentRequestContext();
|
|
361
361
|
if (context) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
362
|
+
var _this_currentUser_role, _this_currentUser;
|
|
363
|
+
// tslint:disable-next-line
|
|
364
|
+
const token = this.currentToken();
|
|
365
|
+
if (token) {
|
|
366
|
+
try {
|
|
366
367
|
const { role } = jsonwebtoken.verify(token, process.env['JWT_SECRET']);
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
} else {
|
|
375
|
-
throw error;
|
|
368
|
+
if (role) {
|
|
369
|
+
return roles.includes(role);
|
|
370
|
+
}
|
|
371
|
+
} catch (error) {
|
|
372
|
+
if (!(error instanceof jsonwebtoken.JsonWebTokenError)) {
|
|
373
|
+
throw error;
|
|
374
|
+
}
|
|
376
375
|
}
|
|
377
376
|
}
|
|
377
|
+
const role = (_this_currentUser = this.currentUser()) == null ? void 0 : (_this_currentUser_role = _this_currentUser.role) == null ? void 0 : _this_currentUser_role.name;
|
|
378
|
+
if (role) {
|
|
379
|
+
return roles.includes(role);
|
|
380
|
+
}
|
|
378
381
|
}
|
|
379
382
|
if (throwError) {
|
|
380
383
|
throw new common.HttpException('Unauthorized', common.HttpStatus.UNAUTHORIZED);
|
|
@@ -2637,6 +2640,52 @@ exports.AgentMiddlewareRegistry = __decorate([
|
|
|
2637
2640
|
"end"
|
|
2638
2641
|
];
|
|
2639
2642
|
|
|
2643
|
+
function createRuntimeCapability(id, options = {}) {
|
|
2644
|
+
return Object.freeze({
|
|
2645
|
+
id,
|
|
2646
|
+
description: options.description
|
|
2647
|
+
});
|
|
2648
|
+
}
|
|
2649
|
+
const XPERT_RUNTIME_CAPABILITIES_TOKEN = 'XPERT_RUNTIME_CAPABILITIES';
|
|
2650
|
+
class DefaultAgentMiddlewareRuntimeCapabilityRegistry {
|
|
2651
|
+
register(key, implementation) {
|
|
2652
|
+
this.capabilities.set(runtimeCapabilityId(key), implementation);
|
|
2653
|
+
return this;
|
|
2654
|
+
}
|
|
2655
|
+
has(key) {
|
|
2656
|
+
return this.capabilities.has(runtimeCapabilityId(key));
|
|
2657
|
+
}
|
|
2658
|
+
get(key) {
|
|
2659
|
+
return this.capabilities.get(runtimeCapabilityId(key));
|
|
2660
|
+
}
|
|
2661
|
+
require(key) {
|
|
2662
|
+
const implementation = this.get(key);
|
|
2663
|
+
if (!implementation) {
|
|
2664
|
+
throw new Error(`Runtime capability '${runtimeCapabilityId(key)}' is not available`);
|
|
2665
|
+
}
|
|
2666
|
+
return implementation;
|
|
2667
|
+
}
|
|
2668
|
+
constructor(entries = []){
|
|
2669
|
+
this.capabilities = new Map();
|
|
2670
|
+
entries.forEach(([key, implementation])=>this.register(key, implementation));
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
function runtimeCapabilityId(key) {
|
|
2674
|
+
return typeof key === 'string' ? key : key.id;
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
const KnowledgebaseRuntimeCapability = createRuntimeCapability('platform.knowledgebase', {
|
|
2678
|
+
description: 'List, search, and write chunks in platform knowledgebases.'
|
|
2679
|
+
});
|
|
2680
|
+
|
|
2681
|
+
const AssistantTaskRuntimeCapability = createRuntimeCapability('platform.assistant_task', {
|
|
2682
|
+
description: 'Start asynchronous tasks on the current platform assistant.'
|
|
2683
|
+
});
|
|
2684
|
+
|
|
2685
|
+
const FileRuntimeCapability = createRuntimeCapability('platform.file', {
|
|
2686
|
+
description: 'Resolve platform file handles into previewable file URLs.'
|
|
2687
|
+
});
|
|
2688
|
+
|
|
2640
2689
|
const SEGMENT_PATTERN = /^[a-z][a-z0-9_-]*$/i;
|
|
2641
2690
|
const VERSION_PATTERN = /^v[1-9][0-9]*$/;
|
|
2642
2691
|
function assertSegment(input, name) {
|
|
@@ -3972,6 +4021,420 @@ exports.ViewExtensionProviderRegistry = __decorate([
|
|
|
3972
4021
|
])
|
|
3973
4022
|
], exports.ViewExtensionProviderRegistry);
|
|
3974
4023
|
|
|
4024
|
+
const XPERT_REMOTE_UI_CSS = `
|
|
4025
|
+
:root {
|
|
4026
|
+
color-scheme: light;
|
|
4027
|
+
--xui-font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
4028
|
+
--xui-color-background: #fff;
|
|
4029
|
+
--xui-color-foreground: #18181b;
|
|
4030
|
+
--xui-color-card: #fff;
|
|
4031
|
+
--xui-color-card-foreground: #18181b;
|
|
4032
|
+
--xui-color-muted: #f4f4f5;
|
|
4033
|
+
--xui-color-muted-foreground: #71717a;
|
|
4034
|
+
--xui-color-border: #e4e4e7;
|
|
4035
|
+
--xui-color-input: #d4d4d8;
|
|
4036
|
+
--xui-color-primary: #18181b;
|
|
4037
|
+
--xui-color-primary-foreground: #fff;
|
|
4038
|
+
--xui-color-destructive: #dc2626;
|
|
4039
|
+
--xui-color-destructive-background: #fef2f2;
|
|
4040
|
+
--xui-color-success: #047857;
|
|
4041
|
+
--xui-color-success-background: #ecfdf5;
|
|
4042
|
+
--xui-radius-sm: 6px;
|
|
4043
|
+
--xui-radius-md: 8px;
|
|
4044
|
+
--xui-radius-lg: 10px;
|
|
4045
|
+
--xui-font-size-xs: 0.75rem;
|
|
4046
|
+
--xui-font-size-sm: 0.8125rem;
|
|
4047
|
+
--xui-font-size-md: 0.875rem;
|
|
4048
|
+
--xui-font-size-lg: 1rem;
|
|
4049
|
+
--xui-font-size-control: var(--xui-font-size-sm);
|
|
4050
|
+
--xui-font-size-button: var(--xui-font-size-sm);
|
|
4051
|
+
--xui-font-size-table: var(--xui-font-size-sm);
|
|
4052
|
+
--xui-control-height: 2rem;
|
|
4053
|
+
--xui-button-height: 2rem;
|
|
4054
|
+
--xui-button-height-sm: 1.75rem;
|
|
4055
|
+
--xui-shadow-dialog: 0 20px 50px rgba(24, 24, 27, 0.22);
|
|
4056
|
+
}
|
|
4057
|
+
|
|
4058
|
+
* {
|
|
4059
|
+
box-sizing: border-box;
|
|
4060
|
+
}
|
|
4061
|
+
|
|
4062
|
+
body {
|
|
4063
|
+
margin: 0;
|
|
4064
|
+
background: var(--xui-color-background);
|
|
4065
|
+
color: var(--xui-color-foreground);
|
|
4066
|
+
font-family: var(--xui-font-family);
|
|
4067
|
+
font-size: var(--xui-font-size-md);
|
|
4068
|
+
}
|
|
4069
|
+
|
|
4070
|
+
button,
|
|
4071
|
+
input,
|
|
4072
|
+
select,
|
|
4073
|
+
textarea {
|
|
4074
|
+
font: inherit;
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4077
|
+
button {
|
|
4078
|
+
cursor: pointer;
|
|
4079
|
+
}
|
|
4080
|
+
|
|
4081
|
+
button:disabled,
|
|
4082
|
+
input:disabled,
|
|
4083
|
+
select:disabled,
|
|
4084
|
+
textarea:disabled {
|
|
4085
|
+
cursor: not-allowed;
|
|
4086
|
+
opacity: 0.56;
|
|
4087
|
+
}
|
|
4088
|
+
|
|
4089
|
+
.xui-app {
|
|
4090
|
+
min-height: 420px;
|
|
4091
|
+
padding: 2px;
|
|
4092
|
+
}
|
|
4093
|
+
|
|
4094
|
+
.xui-toolbar {
|
|
4095
|
+
display: grid;
|
|
4096
|
+
grid-template-columns: minmax(160px, 240px) minmax(160px, 240px) minmax(180px, 1fr) auto auto;
|
|
4097
|
+
gap: 8px;
|
|
4098
|
+
align-items: center;
|
|
4099
|
+
margin-bottom: 12px;
|
|
4100
|
+
}
|
|
4101
|
+
|
|
4102
|
+
.xui-control,
|
|
4103
|
+
.xui-input,
|
|
4104
|
+
.xui-textarea {
|
|
4105
|
+
width: 100%;
|
|
4106
|
+
min-width: 0;
|
|
4107
|
+
border: 1px solid var(--xui-color-input);
|
|
4108
|
+
border-radius: var(--xui-radius-md);
|
|
4109
|
+
background: var(--xui-color-card);
|
|
4110
|
+
color: var(--xui-color-card-foreground);
|
|
4111
|
+
outline: none;
|
|
4112
|
+
}
|
|
4113
|
+
|
|
4114
|
+
.xui-control,
|
|
4115
|
+
.xui-input {
|
|
4116
|
+
height: var(--xui-control-height);
|
|
4117
|
+
padding: 0 10px;
|
|
4118
|
+
font-size: var(--xui-font-size-control);
|
|
4119
|
+
}
|
|
4120
|
+
|
|
4121
|
+
.xui-textarea {
|
|
4122
|
+
min-height: 84px;
|
|
4123
|
+
padding: 8px 10px;
|
|
4124
|
+
resize: vertical;
|
|
4125
|
+
font-size: var(--xui-font-size-control);
|
|
4126
|
+
}
|
|
4127
|
+
|
|
4128
|
+
.xui-button {
|
|
4129
|
+
display: inline-flex;
|
|
4130
|
+
height: var(--xui-button-height);
|
|
4131
|
+
align-items: center;
|
|
4132
|
+
justify-content: center;
|
|
4133
|
+
gap: 6px;
|
|
4134
|
+
border: 1px solid var(--xui-color-input);
|
|
4135
|
+
border-radius: var(--xui-radius-md);
|
|
4136
|
+
background: var(--xui-color-card);
|
|
4137
|
+
color: var(--xui-color-card-foreground);
|
|
4138
|
+
padding: 0 12px;
|
|
4139
|
+
font-size: var(--xui-font-size-button);
|
|
4140
|
+
white-space: nowrap;
|
|
4141
|
+
}
|
|
4142
|
+
|
|
4143
|
+
.xui-button-primary {
|
|
4144
|
+
border-color: var(--xui-color-primary);
|
|
4145
|
+
background: var(--xui-color-primary);
|
|
4146
|
+
color: var(--xui-color-primary-foreground);
|
|
4147
|
+
}
|
|
4148
|
+
|
|
4149
|
+
.xui-button-danger {
|
|
4150
|
+
border-color: color-mix(in srgb, var(--xui-color-destructive) 32%, transparent);
|
|
4151
|
+
color: var(--xui-color-destructive);
|
|
4152
|
+
}
|
|
4153
|
+
|
|
4154
|
+
.xui-button-sm {
|
|
4155
|
+
height: var(--xui-button-height-sm);
|
|
4156
|
+
padding: 0 8px;
|
|
4157
|
+
font-size: var(--xui-font-size-xs);
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4160
|
+
.xui-notice {
|
|
4161
|
+
display: flex;
|
|
4162
|
+
align-items: center;
|
|
4163
|
+
min-height: 36px;
|
|
4164
|
+
margin-bottom: 12px;
|
|
4165
|
+
border: 1px solid var(--xui-color-border);
|
|
4166
|
+
border-radius: var(--xui-radius-md);
|
|
4167
|
+
padding: 8px 10px;
|
|
4168
|
+
color: var(--xui-color-muted-foreground);
|
|
4169
|
+
background: var(--xui-color-muted);
|
|
4170
|
+
font-size: var(--xui-font-size-sm);
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
.xui-notice-error {
|
|
4174
|
+
border-color: color-mix(in srgb, var(--xui-color-destructive) 32%, transparent);
|
|
4175
|
+
color: var(--xui-color-destructive);
|
|
4176
|
+
background: var(--xui-color-destructive-background);
|
|
4177
|
+
}
|
|
4178
|
+
|
|
4179
|
+
.xui-table-wrap {
|
|
4180
|
+
overflow: auto;
|
|
4181
|
+
border: 1px solid var(--xui-color-border);
|
|
4182
|
+
border-radius: var(--xui-radius-md);
|
|
4183
|
+
}
|
|
4184
|
+
|
|
4185
|
+
.xui-table {
|
|
4186
|
+
width: 100%;
|
|
4187
|
+
min-width: 880px;
|
|
4188
|
+
border-collapse: collapse;
|
|
4189
|
+
}
|
|
4190
|
+
|
|
4191
|
+
.xui-table th,
|
|
4192
|
+
.xui-table td {
|
|
4193
|
+
border-bottom: 1px solid var(--xui-color-border);
|
|
4194
|
+
padding: 10px;
|
|
4195
|
+
text-align: left;
|
|
4196
|
+
vertical-align: middle;
|
|
4197
|
+
font-size: var(--xui-font-size-table);
|
|
4198
|
+
}
|
|
4199
|
+
|
|
4200
|
+
.xui-table th {
|
|
4201
|
+
background: var(--xui-color-muted);
|
|
4202
|
+
color: var(--xui-color-muted-foreground);
|
|
4203
|
+
font-weight: 600;
|
|
4204
|
+
}
|
|
4205
|
+
|
|
4206
|
+
.xui-table tr:last-child td {
|
|
4207
|
+
border-bottom: 0;
|
|
4208
|
+
}
|
|
4209
|
+
|
|
4210
|
+
.xui-muted {
|
|
4211
|
+
color: var(--xui-color-muted-foreground);
|
|
4212
|
+
}
|
|
4213
|
+
|
|
4214
|
+
.xui-pill {
|
|
4215
|
+
display: inline-flex;
|
|
4216
|
+
align-items: center;
|
|
4217
|
+
border: 1px solid var(--xui-color-border);
|
|
4218
|
+
border-radius: 999px;
|
|
4219
|
+
padding: 2px 8px;
|
|
4220
|
+
font-size: var(--xui-font-size-xs);
|
|
4221
|
+
color: var(--xui-color-muted-foreground);
|
|
4222
|
+
background: var(--xui-color-muted);
|
|
4223
|
+
}
|
|
4224
|
+
|
|
4225
|
+
.xui-actions {
|
|
4226
|
+
display: flex;
|
|
4227
|
+
flex-wrap: wrap;
|
|
4228
|
+
gap: 6px;
|
|
4229
|
+
}
|
|
4230
|
+
|
|
4231
|
+
.xui-pager {
|
|
4232
|
+
display: flex;
|
|
4233
|
+
align-items: center;
|
|
4234
|
+
justify-content: space-between;
|
|
4235
|
+
gap: 12px;
|
|
4236
|
+
margin-top: 12px;
|
|
4237
|
+
color: var(--xui-color-muted-foreground);
|
|
4238
|
+
font-size: var(--xui-font-size-sm);
|
|
4239
|
+
}
|
|
4240
|
+
|
|
4241
|
+
.xui-empty {
|
|
4242
|
+
display: grid;
|
|
4243
|
+
min-height: 180px;
|
|
4244
|
+
place-items: center;
|
|
4245
|
+
color: var(--xui-color-muted-foreground);
|
|
4246
|
+
font-size: var(--xui-font-size-md);
|
|
4247
|
+
}
|
|
4248
|
+
|
|
4249
|
+
.xui-modal-backdrop {
|
|
4250
|
+
position: fixed;
|
|
4251
|
+
inset: 0;
|
|
4252
|
+
display: grid;
|
|
4253
|
+
place-items: center;
|
|
4254
|
+
background: rgba(24, 24, 27, 0.32);
|
|
4255
|
+
padding: 16px;
|
|
4256
|
+
}
|
|
4257
|
+
|
|
4258
|
+
.xui-modal {
|
|
4259
|
+
width: min(720px, 100%);
|
|
4260
|
+
max-height: calc(100vh - 32px);
|
|
4261
|
+
overflow: auto;
|
|
4262
|
+
border-radius: var(--xui-radius-lg);
|
|
4263
|
+
background: var(--xui-color-card);
|
|
4264
|
+
color: var(--xui-color-card-foreground);
|
|
4265
|
+
box-shadow: var(--xui-shadow-dialog);
|
|
4266
|
+
}
|
|
4267
|
+
|
|
4268
|
+
.xui-modal-header,
|
|
4269
|
+
.xui-modal-footer {
|
|
4270
|
+
display: flex;
|
|
4271
|
+
align-items: center;
|
|
4272
|
+
justify-content: space-between;
|
|
4273
|
+
gap: 12px;
|
|
4274
|
+
padding: 14px 16px;
|
|
4275
|
+
border-bottom: 1px solid var(--xui-color-border);
|
|
4276
|
+
}
|
|
4277
|
+
|
|
4278
|
+
.xui-modal-footer {
|
|
4279
|
+
border-top: 1px solid var(--xui-color-border);
|
|
4280
|
+
border-bottom: 0;
|
|
4281
|
+
}
|
|
4282
|
+
|
|
4283
|
+
.xui-modal-title {
|
|
4284
|
+
margin: 0;
|
|
4285
|
+
font-size: var(--xui-font-size-lg);
|
|
4286
|
+
font-weight: 700;
|
|
4287
|
+
}
|
|
4288
|
+
|
|
4289
|
+
.xui-form {
|
|
4290
|
+
display: grid;
|
|
4291
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
4292
|
+
gap: 12px;
|
|
4293
|
+
padding: 16px;
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
.xui-field {
|
|
4297
|
+
display: grid;
|
|
4298
|
+
gap: 6px;
|
|
4299
|
+
}
|
|
4300
|
+
|
|
4301
|
+
.xui-field-full {
|
|
4302
|
+
grid-column: 1 / -1;
|
|
4303
|
+
}
|
|
4304
|
+
|
|
4305
|
+
.xui-field label {
|
|
4306
|
+
color: var(--xui-color-muted-foreground);
|
|
4307
|
+
font-size: var(--xui-font-size-xs);
|
|
4308
|
+
font-weight: 600;
|
|
4309
|
+
}
|
|
4310
|
+
|
|
4311
|
+
.xui-checkbox {
|
|
4312
|
+
display: inline-flex;
|
|
4313
|
+
align-items: center;
|
|
4314
|
+
gap: 8px;
|
|
4315
|
+
color: var(--xui-color-card-foreground);
|
|
4316
|
+
font-size: var(--xui-font-size-sm);
|
|
4317
|
+
}
|
|
4318
|
+
|
|
4319
|
+
@media (max-width: 760px) {
|
|
4320
|
+
.xui-toolbar,
|
|
4321
|
+
.xui-form {
|
|
4322
|
+
grid-template-columns: 1fr;
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
`;
|
|
4326
|
+
const XPERT_REMOTE_UI_BOOTSTRAP = `
|
|
4327
|
+
(function () {
|
|
4328
|
+
var CHANNEL = 'xpertai.remote_component'
|
|
4329
|
+
var VERSION = 1
|
|
4330
|
+
var TOKEN_MAP = {
|
|
4331
|
+
fontFamily: '--xui-font-family',
|
|
4332
|
+
colorBackground: '--xui-color-background',
|
|
4333
|
+
colorForeground: '--xui-color-foreground',
|
|
4334
|
+
colorCard: '--xui-color-card',
|
|
4335
|
+
colorCardForeground: '--xui-color-card-foreground',
|
|
4336
|
+
colorMuted: '--xui-color-muted',
|
|
4337
|
+
colorMutedForeground: '--xui-color-muted-foreground',
|
|
4338
|
+
colorBorder: '--xui-color-border',
|
|
4339
|
+
colorInput: '--xui-color-input',
|
|
4340
|
+
colorPrimary: '--xui-color-primary',
|
|
4341
|
+
colorPrimaryForeground: '--xui-color-primary-foreground',
|
|
4342
|
+
colorDestructive: '--xui-color-destructive',
|
|
4343
|
+
colorDestructiveBackground: '--xui-color-destructive-background',
|
|
4344
|
+
colorSuccess: '--xui-color-success',
|
|
4345
|
+
colorSuccessBackground: '--xui-color-success-background',
|
|
4346
|
+
radiusSm: '--xui-radius-sm',
|
|
4347
|
+
radiusMd: '--xui-radius-md',
|
|
4348
|
+
radiusLg: '--xui-radius-lg',
|
|
4349
|
+
fontSizeXs: '--xui-font-size-xs',
|
|
4350
|
+
fontSizeSm: '--xui-font-size-sm',
|
|
4351
|
+
fontSizeMd: '--xui-font-size-md',
|
|
4352
|
+
fontSizeLg: '--xui-font-size-lg',
|
|
4353
|
+
fontSizeControl: '--xui-font-size-control',
|
|
4354
|
+
fontSizeButton: '--xui-font-size-button',
|
|
4355
|
+
fontSizeTable: '--xui-font-size-table',
|
|
4356
|
+
controlHeight: '--xui-control-height',
|
|
4357
|
+
buttonHeight: '--xui-button-height',
|
|
4358
|
+
buttonHeightSm: '--xui-button-height-sm'
|
|
4359
|
+
}
|
|
4360
|
+
|
|
4361
|
+
function isObject(value) {
|
|
4362
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
4363
|
+
}
|
|
4364
|
+
|
|
4365
|
+
function applyTheme(theme) {
|
|
4366
|
+
var mode = typeof theme === 'string' ? theme : isObject(theme) ? theme.mode : null
|
|
4367
|
+
var tokens = isObject(theme) && isObject(theme.tokens) ? theme.tokens : {}
|
|
4368
|
+
if (mode === 'dark') {
|
|
4369
|
+
document.documentElement.dataset.theme = 'dark'
|
|
4370
|
+
document.documentElement.style.colorScheme = 'dark'
|
|
4371
|
+
} else {
|
|
4372
|
+
document.documentElement.dataset.theme = 'light'
|
|
4373
|
+
document.documentElement.style.colorScheme = 'light'
|
|
4374
|
+
}
|
|
4375
|
+
Object.keys(TOKEN_MAP).forEach(function (key) {
|
|
4376
|
+
var value = tokens[key]
|
|
4377
|
+
if (typeof value === 'string' && value.trim()) {
|
|
4378
|
+
document.documentElement.style.setProperty(TOKEN_MAP[key], value.trim())
|
|
4379
|
+
}
|
|
4380
|
+
})
|
|
4381
|
+
}
|
|
4382
|
+
|
|
4383
|
+
window.XpertRemoteUI = {
|
|
4384
|
+
applyTheme: applyTheme
|
|
4385
|
+
}
|
|
4386
|
+
|
|
4387
|
+
window.addEventListener('message', function (event) {
|
|
4388
|
+
var message = event.data
|
|
4389
|
+
if (
|
|
4390
|
+
!isObject(message) ||
|
|
4391
|
+
message.channel !== CHANNEL ||
|
|
4392
|
+
message.protocolVersion !== VERSION ||
|
|
4393
|
+
message.type !== 'init'
|
|
4394
|
+
) {
|
|
4395
|
+
return
|
|
4396
|
+
}
|
|
4397
|
+
applyTheme(message.theme)
|
|
4398
|
+
})
|
|
4399
|
+
})()
|
|
4400
|
+
`;
|
|
4401
|
+
function renderRemoteReactIframeHtml(options) {
|
|
4402
|
+
var _options_lang, _options_appCss;
|
|
4403
|
+
return `<!doctype html>
|
|
4404
|
+
<html lang="${escapeHtmlAttribute((_options_lang = options.lang) != null ? _options_lang : 'en')}">
|
|
4405
|
+
<head>
|
|
4406
|
+
<meta charset="utf-8" />
|
|
4407
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
4408
|
+
<title>${escapeHtml(options.title)}</title>
|
|
4409
|
+
<style>
|
|
4410
|
+
${XPERT_REMOTE_UI_CSS}
|
|
4411
|
+
${(_options_appCss = options.appCss) != null ? _options_appCss : ''}
|
|
4412
|
+
</style>
|
|
4413
|
+
<script>
|
|
4414
|
+
${options.reactUmd}
|
|
4415
|
+
</script>
|
|
4416
|
+
<script>
|
|
4417
|
+
${options.reactDomUmd}
|
|
4418
|
+
</script>
|
|
4419
|
+
<script>
|
|
4420
|
+
${XPERT_REMOTE_UI_BOOTSTRAP}
|
|
4421
|
+
</script>
|
|
4422
|
+
</head>
|
|
4423
|
+
<body>
|
|
4424
|
+
<div id="root"></div>
|
|
4425
|
+
<script>
|
|
4426
|
+
${options.appScript}
|
|
4427
|
+
</script>
|
|
4428
|
+
</body>
|
|
4429
|
+
</html>`;
|
|
4430
|
+
}
|
|
4431
|
+
function escapeHtml(value) {
|
|
4432
|
+
return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''');
|
|
4433
|
+
}
|
|
4434
|
+
function escapeHtmlAttribute(value) {
|
|
4435
|
+
return escapeHtml(value).replace(/`/g, '`');
|
|
4436
|
+
}
|
|
4437
|
+
|
|
3975
4438
|
const VIEW_EXTENSION_CACHE_SERVICE_TOKEN = 'XPERT_PLUGIN_VIEW_EXTENSION_CACHE_SERVICE';
|
|
3976
4439
|
|
|
3977
4440
|
exports.ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN = ACCOUNT_BINDING_PERMISSION_SERVICE_TOKEN;
|
|
@@ -3984,6 +4447,7 @@ exports.ANALYTICS_PERMISSION_SERVICE_TOKEN = ANALYTICS_PERMISSION_SERVICE_TOKEN;
|
|
|
3984
4447
|
exports.AdapterDataSourceStrategy = AdapterDataSourceStrategy;
|
|
3985
4448
|
exports.AgentMiddlewareStrategy = AgentMiddlewareStrategy;
|
|
3986
4449
|
exports.AiModelNotFoundException = AiModelNotFoundException;
|
|
4450
|
+
exports.AssistantTaskRuntimeCapability = AssistantTaskRuntimeCapability;
|
|
3987
4451
|
exports.BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN = BOUND_IDENTITY_LOGIN_PERMISSION_SERVICE_TOKEN;
|
|
3988
4452
|
exports.BaseHTTPQueryRunner = BaseHTTPQueryRunner;
|
|
3989
4453
|
exports.BaseQueryRunner = BaseQueryRunner;
|
|
@@ -4016,10 +4480,12 @@ exports.DEFAULT_SANDBOX_SHELL_TIMEOUT_SEC = DEFAULT_SANDBOX_SHELL_TIMEOUT_SEC;
|
|
|
4016
4480
|
exports.DOCUMENT_SOURCE_STRATEGY = DOCUMENT_SOURCE_STRATEGY;
|
|
4017
4481
|
exports.DOCUMENT_TRANSFORMER_STRATEGY = DOCUMENT_TRANSFORMER_STRATEGY;
|
|
4018
4482
|
exports.DataSourceStrategy = DataSourceStrategy;
|
|
4483
|
+
exports.DefaultAgentMiddlewareRuntimeCapabilityRegistry = DefaultAgentMiddlewareRuntimeCapabilityRegistry;
|
|
4019
4484
|
exports.DocumentSourceStrategy = DocumentSourceStrategy;
|
|
4020
4485
|
exports.DocumentTransformerStrategy = DocumentTransformerStrategy;
|
|
4021
4486
|
exports.FILE_STORAGE_PROVIDER = FILE_STORAGE_PROVIDER;
|
|
4022
4487
|
exports.FILE_UPLOAD_TARGET_STRATEGY = FILE_UPLOAD_TARGET_STRATEGY;
|
|
4488
|
+
exports.FileRuntimeCapability = FileRuntimeCapability;
|
|
4023
4489
|
exports.FileStorageProvider = FileStorageProvider;
|
|
4024
4490
|
exports.FileUploadTargetStrategy = FileUploadTargetStrategy;
|
|
4025
4491
|
exports.GLOBAL_ORGANIZATION_SCOPE = GLOBAL_ORGANIZATION_SCOPE;
|
|
@@ -4036,6 +4502,7 @@ exports.JUMP_TO_TARGETS = JUMP_TO_TARGETS;
|
|
|
4036
4502
|
exports.JsonSchemaValidator = JsonSchemaValidator;
|
|
4037
4503
|
exports.KNOWLEDGE_STRATEGY = KNOWLEDGE_STRATEGY;
|
|
4038
4504
|
exports.KnowledgeStrategyKey = KnowledgeStrategyKey;
|
|
4505
|
+
exports.KnowledgebaseRuntimeCapability = KnowledgebaseRuntimeCapability;
|
|
4039
4506
|
exports.LLMUsage = LLMUsage;
|
|
4040
4507
|
exports.LargeLanguageModel = LargeLanguageModel;
|
|
4041
4508
|
exports.ORGANIZATION_METADATA_KEY = ORGANIZATION_METADATA_KEY;
|
|
@@ -4083,6 +4550,7 @@ exports.WORKFLOW_TRIGGER_STRATEGY = WORKFLOW_TRIGGER_STRATEGY;
|
|
|
4083
4550
|
exports.WorkflowNodeStrategy = WorkflowNodeStrategy;
|
|
4084
4551
|
exports.WorkflowTriggerStrategy = WorkflowTriggerStrategy;
|
|
4085
4552
|
exports.WrapWorkflowNodeExecutionCommand = WrapWorkflowNodeExecutionCommand;
|
|
4553
|
+
exports.XPERT_RUNTIME_CAPABILITIES_TOKEN = XPERT_RUNTIME_CAPABILITIES_TOKEN;
|
|
4086
4554
|
exports.XpFileSystem = XpFileSystem;
|
|
4087
4555
|
exports.XpertServerPlugin = XpertServerPlugin;
|
|
4088
4556
|
exports.als = als;
|
|
@@ -4093,6 +4561,7 @@ exports.chunkText = chunkText;
|
|
|
4093
4561
|
exports.countTokensSafe = countTokensSafe;
|
|
4094
4562
|
exports.createI18nInstance = createI18nInstance;
|
|
4095
4563
|
exports.createPluginLogger = createPluginLogger;
|
|
4564
|
+
exports.createRuntimeCapability = createRuntimeCapability;
|
|
4096
4565
|
exports.defineAgentMessageType = defineAgentMessageType;
|
|
4097
4566
|
exports.defineChannelMessageType = defineChannelMessageType;
|
|
4098
4567
|
exports.downloadRemoteFile = downloadRemoteFile;
|
|
@@ -4114,6 +4583,7 @@ exports.loadYamlFile = loadYamlFile;
|
|
|
4114
4583
|
exports.mergeCredentials = mergeCredentials;
|
|
4115
4584
|
exports.mergeParentChildChunks = mergeParentChildChunks;
|
|
4116
4585
|
exports.normalizeContextSize = normalizeContextSize;
|
|
4586
|
+
exports.renderRemoteReactIframeHtml = renderRemoteReactIframeHtml;
|
|
4117
4587
|
exports.resolveSandboxBackend = resolveSandboxBackend;
|
|
4118
4588
|
exports.resolveSandboxExecutionOptions = resolveSandboxExecutionOptions;
|
|
4119
4589
|
exports.resolveSandboxManagedServiceAdapter = resolveSandboxManagedServiceAdapter;
|