@fugood/bricks-project 2.22.0-beta.3 → 2.22.0-beta.5
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/compile/action-name-map.ts +33 -0
- package/package.json +2 -2
- package/types/generators.ts +546 -0
- package/utils/event-props.ts +73 -0
|
@@ -512,6 +512,28 @@ export const templateActionNameMap = {
|
|
|
512
512
|
paramsString: 'GENERATOR_SQLITE_PARAMS_STRING',
|
|
513
513
|
},
|
|
514
514
|
},
|
|
515
|
+
|
|
516
|
+
GENERATOR_MCP: {
|
|
517
|
+
GENERATOR_MCP_LIST_RESOURCES: {
|
|
518
|
+
requestId: 'GENERATOR_MCP_REQUEST_ID',
|
|
519
|
+
},
|
|
520
|
+
GENERATOR_MCP_LIST_RESOURCE_TEMPLATES: {
|
|
521
|
+
requestId: 'GENERATOR_MCP_REQUEST_ID',
|
|
522
|
+
},
|
|
523
|
+
GENERATOR_MCP_READ_RESOURCE: {
|
|
524
|
+
requestId: 'GENERATOR_MCP_REQUEST_ID',
|
|
525
|
+
uri: 'GENERATOR_MCP_URI',
|
|
526
|
+
variables: 'GENERATOR_MCP_VARIABLES',
|
|
527
|
+
},
|
|
528
|
+
GENERATOR_MCP_LIST_TOOLS: {
|
|
529
|
+
requestId: 'GENERATOR_MCP_REQUEST_ID',
|
|
530
|
+
},
|
|
531
|
+
GENERATOR_MCP_CALL_TOOL: {
|
|
532
|
+
requestId: 'GENERATOR_MCP_REQUEST_ID',
|
|
533
|
+
name: 'GENERATOR_MCP_NAME',
|
|
534
|
+
variables: 'GENERATOR_MCP_VARIABLES',
|
|
535
|
+
},
|
|
536
|
+
},
|
|
515
537
|
GENERATOR_TTS: {
|
|
516
538
|
GENERATOR_TTS_GENERATE: {
|
|
517
539
|
text: 'GENERATOR_TTS_TEXT',
|
|
@@ -630,6 +652,11 @@ export const templateActionNameMap = {
|
|
|
630
652
|
responseFormat: 'GENERATOR_OPENAI_LLM_RESPONSE_FORMAT',
|
|
631
653
|
},
|
|
632
654
|
},
|
|
655
|
+
GENERATOR_OPENAI_TTS: {
|
|
656
|
+
GENERATOR_OPENAI_TTS_GENERATE: {
|
|
657
|
+
text: 'GENERATOR_OPENAI_TTS_TEXT',
|
|
658
|
+
},
|
|
659
|
+
},
|
|
633
660
|
GENERATOR_ASSISTANT: {
|
|
634
661
|
GENERATOR_ASSISTANT_ADD_MESSAGE: {
|
|
635
662
|
role: 'GENERATOR_ASSISTANT_ROLE',
|
|
@@ -679,6 +706,12 @@ export const templateActionNameMap = {
|
|
|
679
706
|
GENERATOR_ASSISTANT_REMOVE_MESSAGE_AT_INDEX: {
|
|
680
707
|
index: 'GENERATOR_ASSISTANT_INDEX',
|
|
681
708
|
},
|
|
709
|
+
GENERATOR_ASSISTANT_INSERT_MCP_RESOURCE: {
|
|
710
|
+
mcpClientName: 'GENERATOR_ASSISTANT_MCP_CLIENT_NAME',
|
|
711
|
+
mcpResourceUri: 'GENERATOR_ASSISTANT_MCP_RESOURCE_URI',
|
|
712
|
+
mcpVariables: 'GENERATOR_ASSISTANT_MCP_VARIABLES',
|
|
713
|
+
role: 'GENERATOR_ASSISTANT_ROLE',
|
|
714
|
+
},
|
|
682
715
|
},
|
|
683
716
|
GENERATOR_VECTOR_STORE: {
|
|
684
717
|
GENERATOR_VECTOR_STORE_RESET: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-project",
|
|
3
|
-
"version": "2.22.0-beta.
|
|
3
|
+
"version": "2.22.0-beta.5",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node scripts/build.js"
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"lodash": "^4.17.4",
|
|
15
15
|
"uuid": "^8.3.1"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "5e7016bedfd5ccc55ae6ea7a54f87e97a593a62b"
|
|
18
18
|
}
|
package/types/generators.ts
CHANGED
|
@@ -4307,6 +4307,408 @@ export type GeneratorSqlite = Generator &
|
|
|
4307
4307
|
>
|
|
4308
4308
|
}
|
|
4309
4309
|
|
|
4310
|
+
/* Refresh tools and resources, used for case if tools or resources are changed. Note that the current connections will be closed. */
|
|
4311
|
+
export type GeneratorMCPServerActionRefreshResources = Action & {
|
|
4312
|
+
__actionName: 'GENERATOR_MCP_SERVER_REFRESH_RESOURCES'
|
|
4313
|
+
}
|
|
4314
|
+
|
|
4315
|
+
/* End stream */
|
|
4316
|
+
export type GeneratorMCPServerActionEndStream = Action & {
|
|
4317
|
+
__actionName: 'GENERATOR_MCP_SERVER_END_STREAM'
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4320
|
+
interface GeneratorMCPServerDef {
|
|
4321
|
+
/*
|
|
4322
|
+
Default property:
|
|
4323
|
+
{
|
|
4324
|
+
"enabled": true,
|
|
4325
|
+
"listening": true,
|
|
4326
|
+
"authType": "none",
|
|
4327
|
+
"name": "bricks-foundation-mcp-server-default",
|
|
4328
|
+
"version": "1.0.0",
|
|
4329
|
+
"resources": [],
|
|
4330
|
+
"tools": []
|
|
4331
|
+
}
|
|
4332
|
+
*/
|
|
4333
|
+
property?: {
|
|
4334
|
+
/* Enable MCP server. If enabled and Listening is false, the generator can still provide application-scoped resources. */
|
|
4335
|
+
enabled?: boolean | DataLink
|
|
4336
|
+
/* Start MCP server */
|
|
4337
|
+
listening?: boolean | DataLink
|
|
4338
|
+
/* HTTP server port */
|
|
4339
|
+
port?: number | DataLink
|
|
4340
|
+
/* Authorization type of HTTP request */
|
|
4341
|
+
authType?: 'none' | 'bearer' | DataLink
|
|
4342
|
+
/* Token of bearer auth */
|
|
4343
|
+
bearerToken?: string | DataLink
|
|
4344
|
+
/* Name of the MCP server */
|
|
4345
|
+
name?: string | DataLink
|
|
4346
|
+
/* Version of the MCP server */
|
|
4347
|
+
version?: string | DataLink
|
|
4348
|
+
/* Resources
|
|
4349
|
+
Type:
|
|
4350
|
+
`static`: Return static data
|
|
4351
|
+
`detect-data-change`: Watch data target change to return data,
|
|
4352
|
+
please update data with ({ id: string, content: string | object }),
|
|
4353
|
+
and ensure the id is same with request id
|
|
4354
|
+
`script`: Not implemented yet */
|
|
4355
|
+
resources?:
|
|
4356
|
+
| Array<
|
|
4357
|
+
| DataLink
|
|
4358
|
+
| {
|
|
4359
|
+
enabled?: boolean | DataLink
|
|
4360
|
+
name?: string | DataLink
|
|
4361
|
+
description?: string | DataLink
|
|
4362
|
+
uriOrTemplate?: string | DataLink
|
|
4363
|
+
type?: 'static' | 'detect-data-change' | 'script' | DataLink
|
|
4364
|
+
staticData?: any
|
|
4365
|
+
dataChangeConfig?:
|
|
4366
|
+
| DataLink
|
|
4367
|
+
| {
|
|
4368
|
+
target?: string | DataLink
|
|
4369
|
+
timeout?: number | DataLink
|
|
4370
|
+
payload?: any
|
|
4371
|
+
}
|
|
4372
|
+
scriptConfig?:
|
|
4373
|
+
| DataLink
|
|
4374
|
+
| {
|
|
4375
|
+
code?: string | DataLink
|
|
4376
|
+
timeout?: number | DataLink
|
|
4377
|
+
members?:
|
|
4378
|
+
| Array<
|
|
4379
|
+
| DataLink
|
|
4380
|
+
| {
|
|
4381
|
+
handler?: string | DataLink
|
|
4382
|
+
varName?: string | DataLink
|
|
4383
|
+
}
|
|
4384
|
+
>
|
|
4385
|
+
| DataLink
|
|
4386
|
+
payload?: any
|
|
4387
|
+
}
|
|
4388
|
+
}
|
|
4389
|
+
>
|
|
4390
|
+
| DataLink
|
|
4391
|
+
/* Tools
|
|
4392
|
+
Type:
|
|
4393
|
+
`detect-data-change`: Watch data target change to return data,
|
|
4394
|
+
please update data with ({ id: string, content: string | object }),
|
|
4395
|
+
and ensure the id is same with request id.
|
|
4396
|
+
`script`: Not implemented yet */
|
|
4397
|
+
tools?:
|
|
4398
|
+
| Array<
|
|
4399
|
+
| DataLink
|
|
4400
|
+
| {
|
|
4401
|
+
enabled?: boolean | DataLink
|
|
4402
|
+
name?: string | DataLink
|
|
4403
|
+
description?: string | DataLink
|
|
4404
|
+
params?: {} | DataLink
|
|
4405
|
+
type?: 'detect-data-change' | 'script' | DataLink
|
|
4406
|
+
dataChangeConfig?:
|
|
4407
|
+
| DataLink
|
|
4408
|
+
| {
|
|
4409
|
+
target?: string | DataLink
|
|
4410
|
+
timeout?: number | DataLink
|
|
4411
|
+
payload?: any
|
|
4412
|
+
}
|
|
4413
|
+
scriptConfig?:
|
|
4414
|
+
| DataLink
|
|
4415
|
+
| {
|
|
4416
|
+
code?: string | DataLink
|
|
4417
|
+
timeout?: number | DataLink
|
|
4418
|
+
members?:
|
|
4419
|
+
| Array<
|
|
4420
|
+
| DataLink
|
|
4421
|
+
| {
|
|
4422
|
+
handler?: string | DataLink
|
|
4423
|
+
varName?: string | DataLink
|
|
4424
|
+
}
|
|
4425
|
+
>
|
|
4426
|
+
| DataLink
|
|
4427
|
+
payload?: any
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
>
|
|
4431
|
+
| DataLink
|
|
4432
|
+
}
|
|
4433
|
+
events?: {
|
|
4434
|
+
/* Listening of HTTP server */
|
|
4435
|
+
onListening?: Array<EventAction>
|
|
4436
|
+
/* Error of HTTP server */
|
|
4437
|
+
onError?: Array<EventAction>
|
|
4438
|
+
/* Client error of HTTP server */
|
|
4439
|
+
onClientError?: Array<EventAction>
|
|
4440
|
+
/* Client close of HTTP server */
|
|
4441
|
+
onClientClose?: Array<EventAction>
|
|
4442
|
+
/* On request resource (Request: { name: string, uri: string, params: object }) */
|
|
4443
|
+
onRequestResource?: Array<EventAction>
|
|
4444
|
+
/* On call tool (Request: { name: string, params: object }) */
|
|
4445
|
+
onCallTool?: Array<EventAction>
|
|
4446
|
+
}
|
|
4447
|
+
outlets?: {
|
|
4448
|
+
/* Whether the HTTP server is listening */
|
|
4449
|
+
isListening?: () => Data
|
|
4450
|
+
/* Last error of HTTP server */
|
|
4451
|
+
lastError?: () => Data
|
|
4452
|
+
/* Connected remotes (Session ID) */
|
|
4453
|
+
connectedRemotes?: () => Data
|
|
4454
|
+
/* Last resource request ({ name: string, uri: string, params: object }) */
|
|
4455
|
+
lastResourceRequest?: () => Data
|
|
4456
|
+
/* Last tool call ({ name: string, params: object }) */
|
|
4457
|
+
lastToolCall?: () => Data
|
|
4458
|
+
}
|
|
4459
|
+
}
|
|
4460
|
+
|
|
4461
|
+
/* Model Context Protocol (MCP) Server (https://docs.anthropic.com/en/docs/agents-and-tools/mcp) */
|
|
4462
|
+
export type GeneratorMCPServer = Generator &
|
|
4463
|
+
GeneratorMCPServerDef & {
|
|
4464
|
+
templateKey: 'GENERATOR_MCP_SERVER'
|
|
4465
|
+
switches: Array<
|
|
4466
|
+
SwitchDef &
|
|
4467
|
+
GeneratorMCPServerDef & {
|
|
4468
|
+
conds?: Array<{
|
|
4469
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
4470
|
+
cond:
|
|
4471
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
4472
|
+
| SwitchCondData
|
|
4473
|
+
| {
|
|
4474
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
4475
|
+
outlet:
|
|
4476
|
+
| 'isListening'
|
|
4477
|
+
| 'lastError'
|
|
4478
|
+
| 'connectedRemotes'
|
|
4479
|
+
| 'lastResourceRequest'
|
|
4480
|
+
| 'lastToolCall'
|
|
4481
|
+
value: any
|
|
4482
|
+
}
|
|
4483
|
+
}>
|
|
4484
|
+
}
|
|
4485
|
+
>
|
|
4486
|
+
}
|
|
4487
|
+
|
|
4488
|
+
/* Connect to MCP server */
|
|
4489
|
+
export type GeneratorMCPActionConnect = Action & {
|
|
4490
|
+
__actionName: 'GENERATOR_MCP_CONNECT'
|
|
4491
|
+
}
|
|
4492
|
+
|
|
4493
|
+
/* Disconnect from MCP server */
|
|
4494
|
+
export type GeneratorMCPActionDisconnect = Action & {
|
|
4495
|
+
__actionName: 'GENERATOR_MCP_DISCONNECT'
|
|
4496
|
+
}
|
|
4497
|
+
|
|
4498
|
+
/* List resources */
|
|
4499
|
+
export type GeneratorMCPActionListResources = ActionWithParams & {
|
|
4500
|
+
__actionName: 'GENERATOR_MCP_LIST_RESOURCES'
|
|
4501
|
+
params?: Array<{
|
|
4502
|
+
input: 'requestId'
|
|
4503
|
+
value?: string | DataLink | EventProperty
|
|
4504
|
+
mapping?: string
|
|
4505
|
+
}>
|
|
4506
|
+
}
|
|
4507
|
+
|
|
4508
|
+
/* List resource templates */
|
|
4509
|
+
export type GeneratorMCPActionListResourceTemplates = ActionWithParams & {
|
|
4510
|
+
__actionName: 'GENERATOR_MCP_LIST_RESOURCE_TEMPLATES'
|
|
4511
|
+
params?: Array<{
|
|
4512
|
+
input: 'requestId'
|
|
4513
|
+
value?: string | DataLink | EventProperty
|
|
4514
|
+
mapping?: string
|
|
4515
|
+
}>
|
|
4516
|
+
}
|
|
4517
|
+
|
|
4518
|
+
/* Read resource */
|
|
4519
|
+
export type GeneratorMCPActionReadResource = ActionWithParams & {
|
|
4520
|
+
__actionName: 'GENERATOR_MCP_READ_RESOURCE'
|
|
4521
|
+
params?: Array<
|
|
4522
|
+
| {
|
|
4523
|
+
input: 'requestId'
|
|
4524
|
+
value?: string | DataLink | EventProperty
|
|
4525
|
+
mapping?: string
|
|
4526
|
+
}
|
|
4527
|
+
| {
|
|
4528
|
+
input: 'uri'
|
|
4529
|
+
value?: string | DataLink | EventProperty
|
|
4530
|
+
mapping?: string
|
|
4531
|
+
}
|
|
4532
|
+
| {
|
|
4533
|
+
input: 'variables'
|
|
4534
|
+
value?: {} | DataLink | EventProperty
|
|
4535
|
+
mapping?: string
|
|
4536
|
+
}
|
|
4537
|
+
>
|
|
4538
|
+
}
|
|
4539
|
+
|
|
4540
|
+
/* List tools */
|
|
4541
|
+
export type GeneratorMCPActionListTools = ActionWithParams & {
|
|
4542
|
+
__actionName: 'GENERATOR_MCP_LIST_TOOLS'
|
|
4543
|
+
params?: Array<{
|
|
4544
|
+
input: 'requestId'
|
|
4545
|
+
value?: string | DataLink | EventProperty
|
|
4546
|
+
mapping?: string
|
|
4547
|
+
}>
|
|
4548
|
+
}
|
|
4549
|
+
|
|
4550
|
+
/* Call tool */
|
|
4551
|
+
export type GeneratorMCPActionCallTool = ActionWithParams & {
|
|
4552
|
+
__actionName: 'GENERATOR_MCP_CALL_TOOL'
|
|
4553
|
+
params?: Array<
|
|
4554
|
+
| {
|
|
4555
|
+
input: 'requestId'
|
|
4556
|
+
value?: string | DataLink | EventProperty
|
|
4557
|
+
mapping?: string
|
|
4558
|
+
}
|
|
4559
|
+
| {
|
|
4560
|
+
input: 'name'
|
|
4561
|
+
value?: string | DataLink | EventProperty
|
|
4562
|
+
mapping?: string
|
|
4563
|
+
}
|
|
4564
|
+
| {
|
|
4565
|
+
input: 'variables'
|
|
4566
|
+
value?: {} | DataLink | EventProperty
|
|
4567
|
+
mapping?: string
|
|
4568
|
+
}
|
|
4569
|
+
>
|
|
4570
|
+
}
|
|
4571
|
+
|
|
4572
|
+
interface GeneratorMCPDef {
|
|
4573
|
+
/*
|
|
4574
|
+
Default property:
|
|
4575
|
+
{
|
|
4576
|
+
"init": false,
|
|
4577
|
+
"type": "sse",
|
|
4578
|
+
"url": "",
|
|
4579
|
+
"autoReconnect": true,
|
|
4580
|
+
"maxReconnectAttempts": 10,
|
|
4581
|
+
"reconnectInterval": 1000,
|
|
4582
|
+
"generatorId": "",
|
|
4583
|
+
"name": "bricks-foundation-mcp-client-default",
|
|
4584
|
+
"version": "1.0.0",
|
|
4585
|
+
"ignoreResourceInList": [],
|
|
4586
|
+
"ignoreToolInList": [],
|
|
4587
|
+
"requestTimeout": 60000
|
|
4588
|
+
}
|
|
4589
|
+
*/
|
|
4590
|
+
property?: {
|
|
4591
|
+
/* Initialize the MCP client on start */
|
|
4592
|
+
init?: boolean | DataLink
|
|
4593
|
+
/* Type of the MCP connection, e.g. sse or direct-link (generator) */
|
|
4594
|
+
type?: 'sse' | 'direct-link' | DataLink
|
|
4595
|
+
/* URL of the MCP server, e.g. http://localhost:19853/sse */
|
|
4596
|
+
url?: string | DataLink
|
|
4597
|
+
/* Whether to automatically reconnect to the MCP server */
|
|
4598
|
+
autoReconnect?: boolean | DataLink
|
|
4599
|
+
/* Maximum number of reconnection attempts */
|
|
4600
|
+
maxReconnectAttempts?: number | DataLink
|
|
4601
|
+
/* Reconnection interval in milliseconds */
|
|
4602
|
+
reconnectInterval?: number | DataLink
|
|
4603
|
+
/* SSE connection headers */
|
|
4604
|
+
sseHeaders?: {} | DataLink
|
|
4605
|
+
/* Send request headers */
|
|
4606
|
+
sendHeaders?: {} | DataLink
|
|
4607
|
+
/* Bearer token for authentication */
|
|
4608
|
+
bearerToken?: string | DataLink
|
|
4609
|
+
/* Generator MCPServer ID for direct link */
|
|
4610
|
+
generatorId?: string | DataLink
|
|
4611
|
+
/* Name of the MCP client */
|
|
4612
|
+
name?: string | DataLink
|
|
4613
|
+
/* Version of the MCP client */
|
|
4614
|
+
version?: string | DataLink
|
|
4615
|
+
/* Ignore resources in list response */
|
|
4616
|
+
ignoreResourceInList?: Array<string | DataLink> | DataLink
|
|
4617
|
+
/* Ignore tools in list response */
|
|
4618
|
+
ignoreToolInList?: Array<string | DataLink> | DataLink
|
|
4619
|
+
/* Request timeout in milliseconds */
|
|
4620
|
+
requestTimeout?: number | DataLink
|
|
4621
|
+
}
|
|
4622
|
+
events?: {
|
|
4623
|
+
/* On connected */
|
|
4624
|
+
onConnected?: Array<EventAction>
|
|
4625
|
+
/* On connection error */
|
|
4626
|
+
onConnectionError?: Array<EventAction>
|
|
4627
|
+
/* On disconnected */
|
|
4628
|
+
onDisconnected?: Array<EventAction>
|
|
4629
|
+
/* On list resources */
|
|
4630
|
+
onListResources?: Array<EventAction>
|
|
4631
|
+
/* On list resources error */
|
|
4632
|
+
onListResourcesError?: Array<EventAction>
|
|
4633
|
+
/* On list resource templates */
|
|
4634
|
+
onListResourceTemplates?: Array<EventAction>
|
|
4635
|
+
/* On list resource templates error */
|
|
4636
|
+
onListResourceTemplatesError?: Array<EventAction>
|
|
4637
|
+
/* On read resource */
|
|
4638
|
+
onReadResource?: Array<EventAction>
|
|
4639
|
+
/* On read resource error */
|
|
4640
|
+
onReadResourceError?: Array<EventAction>
|
|
4641
|
+
/* On list tools */
|
|
4642
|
+
onListTools?: Array<EventAction>
|
|
4643
|
+
/* On list tools error */
|
|
4644
|
+
onListToolsError?: Array<EventAction>
|
|
4645
|
+
/* On call tool */
|
|
4646
|
+
onCallTool?: Array<EventAction>
|
|
4647
|
+
/* On call tool error */
|
|
4648
|
+
onCallToolError?: Array<EventAction>
|
|
4649
|
+
}
|
|
4650
|
+
outlets?: {
|
|
4651
|
+
/* Connection state */
|
|
4652
|
+
connectionState?: () => Data
|
|
4653
|
+
/* List resources response */
|
|
4654
|
+
listResourcesResponse?: () => Data
|
|
4655
|
+
/* List resources error */
|
|
4656
|
+
listResourcesError?: () => Data
|
|
4657
|
+
/* List resource templates response */
|
|
4658
|
+
listResourceTemplatesResponse?: () => Data
|
|
4659
|
+
/* List resource templates error */
|
|
4660
|
+
listResourceTemplatesError?: () => Data
|
|
4661
|
+
/* Read resource response */
|
|
4662
|
+
readResourceResponse?: () => Data
|
|
4663
|
+
/* Read resource error */
|
|
4664
|
+
readResourceError?: () => Data
|
|
4665
|
+
/* List tools response */
|
|
4666
|
+
listToolsResponse?: () => Data
|
|
4667
|
+
/* List tools error */
|
|
4668
|
+
listToolsError?: () => Data
|
|
4669
|
+
/* Call tool response */
|
|
4670
|
+
callToolResponse?: () => Data
|
|
4671
|
+
/* Call tool error */
|
|
4672
|
+
callToolError?: () => Data
|
|
4673
|
+
/* Last error */
|
|
4674
|
+
lastError?: () => Data
|
|
4675
|
+
}
|
|
4676
|
+
}
|
|
4677
|
+
|
|
4678
|
+
/* Model Context Protocol (MCP) Client, support SSE and Generator MCPServer direct link */
|
|
4679
|
+
export type GeneratorMCP = Generator &
|
|
4680
|
+
GeneratorMCPDef & {
|
|
4681
|
+
templateKey: 'GENERATOR_MCP'
|
|
4682
|
+
switches: Array<
|
|
4683
|
+
SwitchDef &
|
|
4684
|
+
GeneratorMCPDef & {
|
|
4685
|
+
conds?: Array<{
|
|
4686
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
4687
|
+
cond:
|
|
4688
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
4689
|
+
| SwitchCondData
|
|
4690
|
+
| {
|
|
4691
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
4692
|
+
outlet:
|
|
4693
|
+
| 'connectionState'
|
|
4694
|
+
| 'listResourcesResponse'
|
|
4695
|
+
| 'listResourcesError'
|
|
4696
|
+
| 'listResourceTemplatesResponse'
|
|
4697
|
+
| 'listResourceTemplatesError'
|
|
4698
|
+
| 'readResourceResponse'
|
|
4699
|
+
| 'readResourceError'
|
|
4700
|
+
| 'listToolsResponse'
|
|
4701
|
+
| 'listToolsError'
|
|
4702
|
+
| 'callToolResponse'
|
|
4703
|
+
| 'callToolError'
|
|
4704
|
+
| 'lastError'
|
|
4705
|
+
value: any
|
|
4706
|
+
}
|
|
4707
|
+
}>
|
|
4708
|
+
}
|
|
4709
|
+
>
|
|
4710
|
+
}
|
|
4711
|
+
|
|
4310
4712
|
/* Load the model */
|
|
4311
4713
|
export type GeneratorTTSActionLoadModel = Action & {
|
|
4312
4714
|
__actionName: 'GENERATOR_TTS_LOAD_MODEL'
|
|
@@ -6106,6 +6508,104 @@ export type GeneratorOpenAILLM = Generator &
|
|
|
6106
6508
|
>
|
|
6107
6509
|
}
|
|
6108
6510
|
|
|
6511
|
+
/* Generate audio */
|
|
6512
|
+
export type GeneratorOpenAiTTSActionGenerate = ActionWithParams & {
|
|
6513
|
+
__actionName: 'GENERATOR_OPENAI_TTS_GENERATE'
|
|
6514
|
+
params?: Array<{
|
|
6515
|
+
input: 'text'
|
|
6516
|
+
value?: string | DataLink | EventProperty
|
|
6517
|
+
mapping?: string
|
|
6518
|
+
}>
|
|
6519
|
+
}
|
|
6520
|
+
|
|
6521
|
+
/* Clean cache */
|
|
6522
|
+
export type GeneratorOpenAiTTSActionCleanCache = Action & {
|
|
6523
|
+
__actionName: 'GENERATOR_OPENAI_TTS_CLEAN_CACHE'
|
|
6524
|
+
}
|
|
6525
|
+
|
|
6526
|
+
interface GeneratorOpenAiTTSDef {
|
|
6527
|
+
/*
|
|
6528
|
+
Default property:
|
|
6529
|
+
{
|
|
6530
|
+
"apiEndpoint": "https://api.openai.com/v1",
|
|
6531
|
+
"model": "tts-1",
|
|
6532
|
+
"voice": "alloy",
|
|
6533
|
+
"speed": 1,
|
|
6534
|
+
"outputType": "play",
|
|
6535
|
+
"playbackVolume": 100,
|
|
6536
|
+
"cacheGenerated": true,
|
|
6537
|
+
"autoInferEnable": false,
|
|
6538
|
+
"softBreakRegex": "^[^\\r\\n\\t\\f\\v]*([\\r\\n]+|[。!?!?.]\\B)",
|
|
6539
|
+
"hardBreakTime": 500
|
|
6540
|
+
}
|
|
6541
|
+
*/
|
|
6542
|
+
property?: {
|
|
6543
|
+
/* API endpoint URL */
|
|
6544
|
+
apiEndpoint?: string | DataLink
|
|
6545
|
+
/* OpenAI API Key */
|
|
6546
|
+
apiKey?: string | DataLink
|
|
6547
|
+
/* OpenAI TTS model */
|
|
6548
|
+
model?: string | DataLink
|
|
6549
|
+
/* Voice to use
|
|
6550
|
+
Select voice from https://openai.fm , default alloy */
|
|
6551
|
+
voice?: string | DataLink
|
|
6552
|
+
/* Additional instructions for the speech generation */
|
|
6553
|
+
instructions?: string | DataLink
|
|
6554
|
+
/* Speed of the generated audio */
|
|
6555
|
+
speed?: number | DataLink
|
|
6556
|
+
/* Output mode */
|
|
6557
|
+
outputType?: 'play' | 'file' | DataLink
|
|
6558
|
+
/* Playback volume (0 - 100) */
|
|
6559
|
+
playbackVolume?: number | DataLink
|
|
6560
|
+
/* Enable cache for generated audio */
|
|
6561
|
+
cacheGenerated?: boolean | DataLink
|
|
6562
|
+
/* Text to generate */
|
|
6563
|
+
prompt?: string | DataLink
|
|
6564
|
+
/* Auto inference when prompt changes */
|
|
6565
|
+
autoInferEnable?: boolean | DataLink
|
|
6566
|
+
/* Segmentation rule for auto inference */
|
|
6567
|
+
softBreakRegex?: string | DataLink
|
|
6568
|
+
/* Time to force inference when softBreakRegex is not satisfied */
|
|
6569
|
+
hardBreakTime?: number | DataLink
|
|
6570
|
+
}
|
|
6571
|
+
events?: {
|
|
6572
|
+
/* Event triggered when state change */
|
|
6573
|
+
onContextStateChange?: Array<EventAction>
|
|
6574
|
+
/* Event triggered when error occurs */
|
|
6575
|
+
onError?: Array<EventAction>
|
|
6576
|
+
}
|
|
6577
|
+
outlets?: {
|
|
6578
|
+
/* Context state */
|
|
6579
|
+
contextState?: () => Data
|
|
6580
|
+
/* Generated audio file */
|
|
6581
|
+
generatedAudio?: () => Data
|
|
6582
|
+
/* Generated audio file is playing */
|
|
6583
|
+
generatedAudioPlaying?: () => Data
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
|
|
6587
|
+
/* Generate speech from text using OpenAI's Text-to-Speech API */
|
|
6588
|
+
export type GeneratorOpenAiTTS = Generator &
|
|
6589
|
+
GeneratorOpenAiTTSDef & {
|
|
6590
|
+
templateKey: 'GENERATOR_OPENAI_TTS'
|
|
6591
|
+
switches: Array<
|
|
6592
|
+
SwitchDef &
|
|
6593
|
+
GeneratorOpenAiTTSDef & {
|
|
6594
|
+
conds?: Array<{
|
|
6595
|
+
method: '==' | '!=' | '>' | '<' | '>=' | '<='
|
|
6596
|
+
cond:
|
|
6597
|
+
| SwitchCondInnerStateCurrentCanvas
|
|
6598
|
+
| SwitchCondData
|
|
6599
|
+
| {
|
|
6600
|
+
__typename: 'SwitchCondInnerStateOutlet'
|
|
6601
|
+
outlet: 'contextState' | 'generatedAudio' | 'generatedAudioPlaying'
|
|
6602
|
+
value: any
|
|
6603
|
+
}
|
|
6604
|
+
}>
|
|
6605
|
+
}
|
|
6606
|
+
>
|
|
6607
|
+
}
|
|
6608
|
+
|
|
6109
6609
|
/* Add a message to the assistant */
|
|
6110
6610
|
export type GeneratorAssistantActionAddMessage = ActionWithParams & {
|
|
6111
6611
|
__actionName: 'GENERATOR_ASSISTANT_ADD_MESSAGE'
|
|
@@ -6341,6 +6841,38 @@ export type GeneratorAssistantActionCancel = Action & {
|
|
|
6341
6841
|
__actionName: 'GENERATOR_ASSISTANT_CANCEL'
|
|
6342
6842
|
}
|
|
6343
6843
|
|
|
6844
|
+
/* Check the enabled MCP clients connection status and available tools */
|
|
6845
|
+
export type GeneratorAssistantActionCheckMcpServers = Action & {
|
|
6846
|
+
__actionName: 'GENERATOR_ASSISTANT_CHECK_MCP_SERVERS'
|
|
6847
|
+
}
|
|
6848
|
+
|
|
6849
|
+
/* Insert an MCP resource as a new assistant message */
|
|
6850
|
+
export type GeneratorAssistantActionInsertMcpResource = ActionWithParams & {
|
|
6851
|
+
__actionName: 'GENERATOR_ASSISTANT_INSERT_MCP_RESOURCE'
|
|
6852
|
+
params?: Array<
|
|
6853
|
+
| {
|
|
6854
|
+
input: 'mcpClientName'
|
|
6855
|
+
value?: string | DataLink | EventProperty
|
|
6856
|
+
mapping?: string
|
|
6857
|
+
}
|
|
6858
|
+
| {
|
|
6859
|
+
input: 'mcpResourceUri'
|
|
6860
|
+
value?: string | DataLink | EventProperty
|
|
6861
|
+
mapping?: string
|
|
6862
|
+
}
|
|
6863
|
+
| {
|
|
6864
|
+
input: 'mcpVariables'
|
|
6865
|
+
value?: {} | DataLink | EventProperty
|
|
6866
|
+
mapping?: string
|
|
6867
|
+
}
|
|
6868
|
+
| {
|
|
6869
|
+
input: 'role'
|
|
6870
|
+
value?: string | DataLink | EventProperty
|
|
6871
|
+
mapping?: string
|
|
6872
|
+
}
|
|
6873
|
+
>
|
|
6874
|
+
}
|
|
6875
|
+
|
|
6344
6876
|
interface GeneratorAssistantDef {
|
|
6345
6877
|
/*
|
|
6346
6878
|
Default property:
|
|
@@ -6404,6 +6936,17 @@ Default property:
|
|
|
6404
6936
|
ttsEnabled?: boolean | DataLink
|
|
6405
6937
|
/* TTS Live Policy. If the policy is `only-in-use`, the TTS context will be released when the assistant is not in use. */
|
|
6406
6938
|
ttsLivePolicy?: 'only-in-use' | 'manual' | DataLink
|
|
6939
|
+
/* MCP Generators (Add a unique name if generator name property are duplicate) */
|
|
6940
|
+
mcpGenerators?:
|
|
6941
|
+
| Array<
|
|
6942
|
+
| DataLink
|
|
6943
|
+
| {
|
|
6944
|
+
generatorId?: string | DataLink
|
|
6945
|
+
name?: string | DataLink
|
|
6946
|
+
enabled?: boolean | DataLink
|
|
6947
|
+
}
|
|
6948
|
+
>
|
|
6949
|
+
| DataLink
|
|
6407
6950
|
}
|
|
6408
6951
|
events?: {
|
|
6409
6952
|
/* Error event */
|
|
@@ -6426,6 +6969,8 @@ Default property:
|
|
|
6426
6969
|
files?: () => Data
|
|
6427
6970
|
/* Messages of the assistant */
|
|
6428
6971
|
messages?: () => Data
|
|
6972
|
+
/* MCP servers status and available tools */
|
|
6973
|
+
mcpServers?: () => Data
|
|
6429
6974
|
}
|
|
6430
6975
|
}
|
|
6431
6976
|
|
|
@@ -6450,6 +6995,7 @@ export type GeneratorAssistant = Generator &
|
|
|
6450
6995
|
| 'isBusy'
|
|
6451
6996
|
| 'files'
|
|
6452
6997
|
| 'messages'
|
|
6998
|
+
| 'mcpServers'
|
|
6453
6999
|
value: any
|
|
6454
7000
|
}
|
|
6455
7001
|
}>
|
package/utils/event-props.ts
CHANGED
|
@@ -615,6 +615,71 @@ export const templateEventPropsMap = {
|
|
|
615
615
|
'GENERATOR_SQLITE_QUERY_RESULT', // type: array
|
|
616
616
|
],
|
|
617
617
|
},
|
|
618
|
+
GENERATOR_MCP_SERVER: {
|
|
619
|
+
onError: [
|
|
620
|
+
'GENERATOR_MCP_SERVER_ERROR_MESSAGE', // type: string
|
|
621
|
+
],
|
|
622
|
+
onClientError: [
|
|
623
|
+
'GENERATOR_MCP_SERVER_CLIENT_ADDRESS', // type: string
|
|
624
|
+
'GENERATOR_MCP_SERVER_SESSION_ID', // type: string
|
|
625
|
+
'GENERATOR_MCP_SERVER_ERROR_MESSAGE', // type: string
|
|
626
|
+
],
|
|
627
|
+
onClientClose: [
|
|
628
|
+
'GENERATOR_MCP_SERVER_CLIENT_ADDRESS', // type: string
|
|
629
|
+
'GENERATOR_MCP_SERVER_SESSION_ID', // type: string
|
|
630
|
+
],
|
|
631
|
+
onRequestResource: [
|
|
632
|
+
'GENERATOR_MCP_SERVER_REQUEST', // type: object
|
|
633
|
+
],
|
|
634
|
+
onCallTool: [
|
|
635
|
+
'GENERATOR_MCP_SERVER_REQUEST', // type: object
|
|
636
|
+
],
|
|
637
|
+
},
|
|
638
|
+
GENERATOR_MCP: {
|
|
639
|
+
onConnectionError: [
|
|
640
|
+
'GENERATOR_MCP_ERROR_MESSAGE', // type: string
|
|
641
|
+
],
|
|
642
|
+
onListResources: [
|
|
643
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
644
|
+
'GENERATOR_MCP_RESPONSE', // type: object
|
|
645
|
+
],
|
|
646
|
+
onListResourcesError: [
|
|
647
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
648
|
+
'GENERATOR_MCP_ERROR_MESSAGE', // type: string
|
|
649
|
+
],
|
|
650
|
+
onListResourceTemplates: [
|
|
651
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
652
|
+
'GENERATOR_MCP_RESPONSE', // type: object
|
|
653
|
+
],
|
|
654
|
+
onListResourceTemplatesError: [
|
|
655
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
656
|
+
'GENERATOR_MCP_ERROR_MESSAGE', // type: string
|
|
657
|
+
],
|
|
658
|
+
onReadResource: [
|
|
659
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
660
|
+
'GENERATOR_MCP_RESPONSE', // type: object
|
|
661
|
+
],
|
|
662
|
+
onReadResourceError: [
|
|
663
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
664
|
+
'GENERATOR_MCP_ERROR_MESSAGE', // type: string
|
|
665
|
+
],
|
|
666
|
+
onListTools: [
|
|
667
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
668
|
+
'GENERATOR_MCP_RESPONSE', // type: object
|
|
669
|
+
],
|
|
670
|
+
onListToolsError: [
|
|
671
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
672
|
+
'GENERATOR_MCP_ERROR_MESSAGE', // type: string
|
|
673
|
+
],
|
|
674
|
+
onCallTool: [
|
|
675
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
676
|
+
'GENERATOR_MCP_RESPONSE', // type: object
|
|
677
|
+
],
|
|
678
|
+
onCallToolError: [
|
|
679
|
+
'GENERATOR_MCP_REQUEST_ID', // type: string
|
|
680
|
+
'GENERATOR_MCP_ERROR_MESSAGE', // type: string
|
|
681
|
+
],
|
|
682
|
+
},
|
|
618
683
|
GENERATOR_TTS: {
|
|
619
684
|
onContextStateChange: [
|
|
620
685
|
'GENERATOR_TTS_CONTEXT_STATE', // type: string
|
|
@@ -699,6 +764,14 @@ export const templateEventPropsMap = {
|
|
|
699
764
|
'GENERATOR_OPENAI_LLM_COMPLETION_FUNCTION_ARGUMENTS', // type: string
|
|
700
765
|
],
|
|
701
766
|
},
|
|
767
|
+
GENERATOR_OPENAI_TTS: {
|
|
768
|
+
onContextStateChange: [
|
|
769
|
+
'GENERATOR_OPENAI_TTS_CONTEXT_STATE', // type: string
|
|
770
|
+
],
|
|
771
|
+
onError: [
|
|
772
|
+
'GENERATOR_OPENAI_TTS_ERROR', // type: string
|
|
773
|
+
],
|
|
774
|
+
},
|
|
702
775
|
GENERATOR_ASSISTANT: {
|
|
703
776
|
onError: [
|
|
704
777
|
'GENERATOR_ASSISTANT_ERROR', // type: string
|