@plitzi/sdk-shared 0.38.4 → 0.38.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/CHANGELOG.md +329 -0
- package/dist/actions/functions.d.ts +10 -0
- package/dist/actions/functions.mjs +10 -10
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.mjs +6 -6
- package/dist/helpers/twigWrapper/inspectTemplate.mjs +14 -7
- package/dist/helpers/twigWrapper/processTwig/processTwig.d.ts +4 -3
- package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +32 -22
- package/dist/history/types.d.ts +4 -4
- package/dist/index.mjs +38 -37
- package/dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.d.ts +10 -0
- package/dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.mjs +4 -0
- package/dist/network/graphql/builder/Mutations/index.d.ts +2 -0
- package/dist/network/graphql/builder/Mutations/index.mjs +124 -122
- package/dist/network/graphql/builder/Queries/InitQuery.d.ts +1 -3
- package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -1
- package/dist/network/graphql/builder/Queries/Space/SpaceDataQuery.d.ts +6 -0
- package/dist/network/graphql/builder/Queries/Space/SpaceDataQuery.mjs +4 -0
- package/dist/network/graphql/builder/Queries/index.d.ts +2 -0
- package/dist/network/graphql/builder/Queries/index.mjs +22 -20
- package/dist/network/spaceEvents.d.ts +2 -2
- package/dist/plugins/bundle.d.ts +26 -0
- package/dist/plugins/bundle.mjs +62 -0
- package/dist/plugins/declaration.d.ts +12 -0
- package/dist/plugins/declaration.mjs +9 -0
- package/dist/queries/queryCache.d.ts +7 -0
- package/dist/queries/queryCache.mjs +14 -7
- package/dist/queries/useQuery.d.ts +2 -0
- package/dist/queries/useQuery.mjs +5 -2
- package/dist/schema/anchor.d.ts +11 -0
- package/dist/schema/anchor.mjs +6 -2
- package/dist/schema/index.mjs +6 -6
- package/dist/schema/markdownHeadings.d.ts +13 -0
- package/dist/schema/markdownHeadings.mjs +24 -0
- package/dist/schema/motion.mjs +1 -1
- package/dist/schema/pageElements.d.ts +12 -0
- package/dist/schema/pageElements.mjs +41 -0
- package/dist/server/index.mjs +4 -4
- package/dist/server/rsc/projectData.d.ts +6 -0
- package/dist/server/rsc/projectData.mjs +4 -0
- package/dist/server/rsc/refreshRsc.d.ts +18 -5
- package/dist/server/rsc/refreshRsc.mjs +80 -20
- package/dist/server/rsc/useRscSync.mjs +26 -15
- package/dist/server/usePluginRoute.d.ts +18 -0
- package/dist/server/usePluginRoute.mjs +14 -0
- package/dist/source/export.d.ts +13 -0
- package/dist/store/index.d.ts +45 -45
- package/dist/style/cssLayers.d.ts +18 -0
- package/dist/style/cssLayers.mjs +14 -0
- package/dist/style/index.d.ts +1 -0
- package/dist/style/index.mjs +11 -10
- package/dist/style/useDisplayMode.d.ts +11 -0
- package/dist/style/useDisplayMode.mjs +18 -0
- package/dist/types/ActionTypes.d.ts +3 -3
- package/dist/types/ComponentTypes.d.ts +13 -0
- package/dist/types/DataTypes.d.ts +36 -0
- package/dist/types/InteractionTypes.d.ts +16 -2
- package/dist/types/SchemaTypes.d.ts +3 -1
- package/dist/types/SchemaTypes.mjs +2 -1
- package/dist/types/ServerTypes.d.ts +58 -7
- package/dist/types/StoreTypes.d.ts +19 -6
- package/dist/types/index.d.ts +1 -2
- package/package.json +46 -28
- package/setupTests.ts +16 -13
- package/dist/types/AITypes.d.ts +0 -80
- package/dist/types/McpTypes/index.d.ts +0 -56
- package/dist/types/McpTypes/index.mjs +0 -0
- /package/dist/types/{AITypes.mjs → DataTypes.mjs} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-shared",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.5",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -767,6 +767,10 @@
|
|
|
767
767
|
"types": "./dist/network/graphql/builder/Mutations/Space/credentials/SpaceUpdateCredentialMutation.d.ts",
|
|
768
768
|
"import": "./dist/network/graphql/builder/Mutations/Space/credentials/SpaceUpdateCredentialMutation.mjs"
|
|
769
769
|
},
|
|
770
|
+
"./network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation": {
|
|
771
|
+
"types": "./dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.d.ts",
|
|
772
|
+
"import": "./dist/network/graphql/builder/Mutations/Space/data/SpaceSaveDataMutation.mjs"
|
|
773
|
+
},
|
|
770
774
|
"./network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation": {
|
|
771
775
|
"types": "./dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.d.ts",
|
|
772
776
|
"import": "./dist/network/graphql/builder/Mutations/Space/flags/SpacePublishFlagsMutation.mjs"
|
|
@@ -983,6 +987,10 @@
|
|
|
983
987
|
"types": "./dist/network/graphql/builder/Queries/Space/SpaceCredentialsQuery.d.ts",
|
|
984
988
|
"import": "./dist/network/graphql/builder/Queries/Space/SpaceCredentialsQuery.mjs"
|
|
985
989
|
},
|
|
990
|
+
"./network/graphql/builder/Queries/Space/SpaceDataQuery": {
|
|
991
|
+
"types": "./dist/network/graphql/builder/Queries/Space/SpaceDataQuery.d.ts",
|
|
992
|
+
"import": "./dist/network/graphql/builder/Queries/Space/SpaceDataQuery.mjs"
|
|
993
|
+
},
|
|
986
994
|
"./network/graphql/builder/Queries/Space/SpaceDeploymentsQuery": {
|
|
987
995
|
"types": "./dist/network/graphql/builder/Queries/Space/SpaceDeploymentsQuery.d.ts",
|
|
988
996
|
"import": "./dist/network/graphql/builder/Queries/Space/SpaceDeploymentsQuery.mjs"
|
|
@@ -1083,6 +1091,14 @@
|
|
|
1083
1091
|
"types": "./dist/network/spaceEvents.d.ts",
|
|
1084
1092
|
"import": "./dist/network/spaceEvents.mjs"
|
|
1085
1093
|
},
|
|
1094
|
+
"./plugins/bundle": {
|
|
1095
|
+
"types": "./dist/plugins/bundle.d.ts",
|
|
1096
|
+
"import": "./dist/plugins/bundle.mjs"
|
|
1097
|
+
},
|
|
1098
|
+
"./plugins/declaration": {
|
|
1099
|
+
"types": "./dist/plugins/declaration.d.ts",
|
|
1100
|
+
"import": "./dist/plugins/declaration.mjs"
|
|
1101
|
+
},
|
|
1086
1102
|
"./queries": {
|
|
1087
1103
|
"types": "./dist/queries/index.d.ts",
|
|
1088
1104
|
"import": "./dist/queries/index.mjs"
|
|
@@ -1139,6 +1155,10 @@
|
|
|
1139
1155
|
"types": "./dist/schema/layoutChain.d.ts",
|
|
1140
1156
|
"import": "./dist/schema/layoutChain.mjs"
|
|
1141
1157
|
},
|
|
1158
|
+
"./schema/markdownHeadings": {
|
|
1159
|
+
"types": "./dist/schema/markdownHeadings.d.ts",
|
|
1160
|
+
"import": "./dist/schema/markdownHeadings.mjs"
|
|
1161
|
+
},
|
|
1142
1162
|
"./schema/motion": {
|
|
1143
1163
|
"types": "./dist/schema/motion.d.ts",
|
|
1144
1164
|
"import": "./dist/schema/motion.mjs"
|
|
@@ -1147,6 +1167,10 @@
|
|
|
1147
1167
|
"types": "./dist/schema/motionReveal.d.ts",
|
|
1148
1168
|
"import": "./dist/schema/motionReveal.mjs"
|
|
1149
1169
|
},
|
|
1170
|
+
"./schema/pageElements": {
|
|
1171
|
+
"types": "./dist/schema/pageElements.d.ts",
|
|
1172
|
+
"import": "./dist/schema/pageElements.mjs"
|
|
1173
|
+
},
|
|
1150
1174
|
"./schema/schemaConstants": {
|
|
1151
1175
|
"types": "./dist/schema/schemaConstants.d.ts",
|
|
1152
1176
|
"import": "./dist/schema/schemaConstants.mjs"
|
|
@@ -1183,6 +1207,10 @@
|
|
|
1183
1207
|
"types": "./dist/server/index.d.ts",
|
|
1184
1208
|
"import": "./dist/server/index.mjs"
|
|
1185
1209
|
},
|
|
1210
|
+
"./server/rsc/projectData": {
|
|
1211
|
+
"types": "./dist/server/rsc/projectData.d.ts",
|
|
1212
|
+
"import": "./dist/server/rsc/projectData.mjs"
|
|
1213
|
+
},
|
|
1186
1214
|
"./server/rsc/refreshRsc": {
|
|
1187
1215
|
"types": "./dist/server/rsc/refreshRsc.d.ts",
|
|
1188
1216
|
"import": "./dist/server/rsc/refreshRsc.mjs"
|
|
@@ -1195,6 +1223,10 @@
|
|
|
1195
1223
|
"types": "./dist/server/rsc/useRscSync.d.ts",
|
|
1196
1224
|
"import": "./dist/server/rsc/useRscSync.mjs"
|
|
1197
1225
|
},
|
|
1226
|
+
"./server/usePluginRoute": {
|
|
1227
|
+
"types": "./dist/server/usePluginRoute.d.ts",
|
|
1228
|
+
"import": "./dist/server/usePluginRoute.mjs"
|
|
1229
|
+
},
|
|
1198
1230
|
"./source": {
|
|
1199
1231
|
"types": "./dist/source/index.d.ts",
|
|
1200
1232
|
"import": "./dist/source/index.mjs"
|
|
@@ -1299,6 +1331,10 @@
|
|
|
1299
1331
|
"types": "./dist/style/breakpoints.d.ts",
|
|
1300
1332
|
"import": "./dist/style/breakpoints.mjs"
|
|
1301
1333
|
},
|
|
1334
|
+
"./style/cssLayers": {
|
|
1335
|
+
"types": "./dist/style/cssLayers.d.ts",
|
|
1336
|
+
"import": "./dist/style/cssLayers.mjs"
|
|
1337
|
+
},
|
|
1302
1338
|
"./style/displayModes": {
|
|
1303
1339
|
"types": "./dist/style/displayModes.d.ts",
|
|
1304
1340
|
"import": "./dist/style/displayModes.mjs"
|
|
@@ -1347,6 +1383,10 @@
|
|
|
1347
1383
|
"types": "./dist/style/styleStates.d.ts",
|
|
1348
1384
|
"import": "./dist/style/styleStates.mjs"
|
|
1349
1385
|
},
|
|
1386
|
+
"./style/useDisplayMode": {
|
|
1387
|
+
"types": "./dist/style/useDisplayMode.d.ts",
|
|
1388
|
+
"import": "./dist/style/useDisplayMode.mjs"
|
|
1389
|
+
},
|
|
1350
1390
|
"./theme": {
|
|
1351
1391
|
"types": "./dist/theme/index.d.ts",
|
|
1352
1392
|
"import": "./dist/theme/index.mjs"
|
|
@@ -1379,9 +1419,6 @@
|
|
|
1379
1419
|
"types": "./dist/types/index.d.ts",
|
|
1380
1420
|
"import": "./dist/types/index.mjs"
|
|
1381
1421
|
},
|
|
1382
|
-
"./types/AITypes": {
|
|
1383
|
-
"types": "./dist/types/AITypes.d.ts"
|
|
1384
|
-
},
|
|
1385
1422
|
"./types/ActionTypes": {
|
|
1386
1423
|
"types": "./dist/types/ActionTypes.d.ts"
|
|
1387
1424
|
},
|
|
@@ -1406,6 +1443,9 @@
|
|
|
1406
1443
|
"./types/DataSourceTypes": {
|
|
1407
1444
|
"types": "./dist/types/DataSourceTypes.d.ts"
|
|
1408
1445
|
},
|
|
1446
|
+
"./types/DataTypes": {
|
|
1447
|
+
"types": "./dist/types/DataTypes.d.ts"
|
|
1448
|
+
},
|
|
1409
1449
|
"./types/DevToolsTypes": {
|
|
1410
1450
|
"types": "./dist/types/DevToolsTypes.d.ts"
|
|
1411
1451
|
},
|
|
@@ -1421,9 +1461,6 @@
|
|
|
1421
1461
|
"./types/InteractionTypes": {
|
|
1422
1462
|
"types": "./dist/types/InteractionTypes.d.ts"
|
|
1423
1463
|
},
|
|
1424
|
-
"./types/McpTypes/index": {
|
|
1425
|
-
"types": "./dist/types/McpTypes/index.d.ts"
|
|
1426
|
-
},
|
|
1427
1464
|
"./types/NavigationTypes": {
|
|
1428
1465
|
"types": "./dist/types/NavigationTypes.d.ts"
|
|
1429
1466
|
},
|
|
@@ -1494,9 +1531,8 @@
|
|
|
1494
1531
|
"build:prod": "vite build && node ./scripts/generate-exports.mjs"
|
|
1495
1532
|
},
|
|
1496
1533
|
"dependencies": {
|
|
1497
|
-
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
1498
1534
|
"@plitzi/nexus": "^1.4.0",
|
|
1499
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
1535
|
+
"@plitzi/plitzi-ui": "^1.6.31",
|
|
1500
1536
|
"date-fns": "^4.4.0",
|
|
1501
1537
|
"immer": "^11.1.21",
|
|
1502
1538
|
"zod": "^4.6.5"
|
|
@@ -1508,33 +1544,17 @@
|
|
|
1508
1544
|
},
|
|
1509
1545
|
"devDependencies": {
|
|
1510
1546
|
"@apollo/client": "^4.3.1",
|
|
1511
|
-
"@babel/cli": "^8.0.6",
|
|
1512
|
-
"@babel/core": "^8.0.6",
|
|
1513
|
-
"@babel/eslint-parser": "^7.29.9",
|
|
1514
|
-
"@babel/plugin-syntax-flow": "^8.0.1",
|
|
1515
|
-
"@babel/plugin-transform-react-jsx": "^8.0.1",
|
|
1516
|
-
"@babel/preset-env": "^8.0.6",
|
|
1517
1547
|
"@eslint/js": "^10.0.1",
|
|
1518
|
-
"@tailwindcss/forms": "^0.5.11",
|
|
1519
1548
|
"@testing-library/dom": "^10.4.2",
|
|
1520
1549
|
"@testing-library/react": "^16.3.3",
|
|
1521
|
-
"@testing-library/react-hooks": "^8.0.1",
|
|
1522
|
-
"@testing-library/user-event": "^14.6.7",
|
|
1523
1550
|
"@types/react": "^19.3.0",
|
|
1524
1551
|
"@types/react-dom": "^19.3.0",
|
|
1525
1552
|
"@vitejs/plugin-react": "^6.1.1",
|
|
1526
1553
|
"@vitest/coverage-v8": "^5.0.3",
|
|
1527
|
-
"
|
|
1554
|
+
"esbuild": "^0.28.2",
|
|
1528
1555
|
"eslint": "^9.39.5",
|
|
1529
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
1530
1556
|
"eslint-config-prettier": "^10.1.8",
|
|
1531
|
-
"eslint-config-turbo": "^2.11.7",
|
|
1532
|
-
"eslint-import-resolver-alias": "^1.1.2",
|
|
1533
|
-
"eslint-plugin-cypress": "^7.0.2",
|
|
1534
|
-
"eslint-plugin-flowtype": "8.0.3",
|
|
1535
1557
|
"eslint-plugin-import": "^2.32.0",
|
|
1536
|
-
"eslint-plugin-jsdoc": "^65.0.2",
|
|
1537
|
-
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
1538
1558
|
"eslint-plugin-prettier": "^5.5.6",
|
|
1539
1559
|
"eslint-plugin-react": "^7.37.5",
|
|
1540
1560
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
@@ -1542,7 +1562,6 @@
|
|
|
1542
1562
|
"eslint-plugin-storybook": "^10.6.1",
|
|
1543
1563
|
"globals": "^17.13.0",
|
|
1544
1564
|
"jsdom": "^30.1.1",
|
|
1545
|
-
"postcss": "^8.5.28",
|
|
1546
1565
|
"prettier": "^3.9.9",
|
|
1547
1566
|
"react": "^19.3.0",
|
|
1548
1567
|
"react-dom": "^19.3.0",
|
|
@@ -1552,7 +1571,6 @@
|
|
|
1552
1571
|
"typescript-eslint": "^8.71.0",
|
|
1553
1572
|
"vite": "^8.3.2",
|
|
1554
1573
|
"vite-plugin-dts": "^5.1.2",
|
|
1555
|
-
"vite-plugin-react": "^4.0.1",
|
|
1556
1574
|
"vitest": "^5.0.3",
|
|
1557
1575
|
"vitest-fetch-mock": "^0.4.5"
|
|
1558
1576
|
},
|
package/setupTests.ts
CHANGED
|
@@ -18,16 +18,19 @@ vi.stubGlobal(
|
|
|
18
18
|
}))
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
// Only where there is a window: a file that opts into `@vitest-environment node` (one running a bundler) has none.
|
|
22
|
+
if (typeof window !== 'undefined') {
|
|
23
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
24
|
+
writable: true,
|
|
25
|
+
value: vi.fn().mockImplementation((query: unknown) => ({
|
|
26
|
+
matches: false,
|
|
27
|
+
media: query,
|
|
28
|
+
onchange: null,
|
|
29
|
+
addListener: vi.fn(),
|
|
30
|
+
removeListener: vi.fn(),
|
|
31
|
+
addEventListener: vi.fn(),
|
|
32
|
+
removeEventListener: vi.fn(),
|
|
33
|
+
dispatchEvent: vi.fn()
|
|
34
|
+
}))
|
|
35
|
+
});
|
|
36
|
+
}
|
package/dist/types/AITypes.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { Environment } from './CommonTypes';
|
|
2
|
-
import { ToolCallEvent } from './McpTypes';
|
|
3
|
-
export type PromptRole = 'user' | 'assistant' | 'system';
|
|
4
|
-
export type AiMode = 'plan' | 'build';
|
|
5
|
-
export type AiRole = 'user' | 'assistant';
|
|
6
|
-
export type AiEffort = 'auto' | 'low' | 'medium' | 'high';
|
|
7
|
-
export type AIToolStatus = 'running' | 'done' | 'failed' | 'interrupted';
|
|
8
|
-
export type AiProviderType = 'openai' | 'anthropic' | 'ollama' | 'openrouter' | 'opencode';
|
|
9
|
-
export type AiUsage = {
|
|
10
|
-
inputTokens: number;
|
|
11
|
-
outputTokens: number;
|
|
12
|
-
totalTokens: number;
|
|
13
|
-
thinkingTokens?: number;
|
|
14
|
-
contextLimit: number;
|
|
15
|
-
usedPercent: number;
|
|
16
|
-
};
|
|
17
|
-
export type AiMessageAttachment = {
|
|
18
|
-
type: 'image';
|
|
19
|
-
mimeType: string;
|
|
20
|
-
data: string;
|
|
21
|
-
};
|
|
22
|
-
export type AiToolCall = {
|
|
23
|
-
id: string;
|
|
24
|
-
name: string;
|
|
25
|
-
args?: Record<string, unknown>;
|
|
26
|
-
result?: unknown;
|
|
27
|
-
error?: string;
|
|
28
|
-
status: AIToolStatus;
|
|
29
|
-
};
|
|
30
|
-
export type AiMessageStep = {
|
|
31
|
-
type: 'thinking';
|
|
32
|
-
text: string;
|
|
33
|
-
durationMs?: number;
|
|
34
|
-
} | {
|
|
35
|
-
type: 'tool';
|
|
36
|
-
id: string;
|
|
37
|
-
name: string;
|
|
38
|
-
args?: Record<string, unknown>;
|
|
39
|
-
result?: unknown;
|
|
40
|
-
error?: string;
|
|
41
|
-
status: AIToolStatus;
|
|
42
|
-
} | {
|
|
43
|
-
type: 'resource';
|
|
44
|
-
name: string;
|
|
45
|
-
uri: string;
|
|
46
|
-
} | {
|
|
47
|
-
type: 'text';
|
|
48
|
-
text: string;
|
|
49
|
-
};
|
|
50
|
-
export type ConversationSummary = {
|
|
51
|
-
id: string;
|
|
52
|
-
spaceId: number;
|
|
53
|
-
messageCount: number;
|
|
54
|
-
preview: string;
|
|
55
|
-
createdAt: string;
|
|
56
|
-
updatedAt: string;
|
|
57
|
-
};
|
|
58
|
-
export type StreamCallbacks = {
|
|
59
|
-
onLog?: (level: 'error' | 'info' | 'debug', content: string) => void;
|
|
60
|
-
onChunk?: (text: string) => void;
|
|
61
|
-
onThinking?: (text: string) => void;
|
|
62
|
-
onUsage?: (usage: Omit<AiUsage, 'usedPercent' | 'contextLimit'> & {
|
|
63
|
-
contextLimit?: number;
|
|
64
|
-
}) => void;
|
|
65
|
-
onBusy?: () => void;
|
|
66
|
-
onBeforeTool?: (name: string, args: Record<string, unknown>) => void;
|
|
67
|
-
onToolSuccess?: (event: ToolCallEvent) => void;
|
|
68
|
-
onToolError?: (event: ToolCallEvent) => void;
|
|
69
|
-
onResourceRead?: (name: string, uri: string) => void;
|
|
70
|
-
};
|
|
71
|
-
export type AiContext = {
|
|
72
|
-
userId: number;
|
|
73
|
-
spaceId: number;
|
|
74
|
-
environment: Environment;
|
|
75
|
-
pubSub?: unknown;
|
|
76
|
-
mode: AiMode;
|
|
77
|
-
currentPageId?: string;
|
|
78
|
-
elementSelected?: string;
|
|
79
|
-
theme?: 'light' | 'dark';
|
|
80
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { AiContext, AiMode, PromptRole } from '../AITypes';
|
|
2
|
-
import { ToolAnnotations } from '@modelcontextprotocol/sdk/types';
|
|
3
|
-
import { ZodType } from 'zod';
|
|
4
|
-
export type ToolOperationType = 'read' | 'write';
|
|
5
|
-
export type McpPromptHandlerResult = {
|
|
6
|
-
messages: {
|
|
7
|
-
role: Exclude<PromptRole, 'system'>;
|
|
8
|
-
content: {
|
|
9
|
-
type: 'text';
|
|
10
|
-
text: string;
|
|
11
|
-
};
|
|
12
|
-
}[];
|
|
13
|
-
};
|
|
14
|
-
export type McpPromptHandler = (args: Record<string, any>, ctx: AiContext) => Promise<McpPromptHandlerResult>;
|
|
15
|
-
export type McpTextContent = {
|
|
16
|
-
type: 'text';
|
|
17
|
-
text: string;
|
|
18
|
-
};
|
|
19
|
-
export type McpImageContent = {
|
|
20
|
-
type: 'image';
|
|
21
|
-
data: string;
|
|
22
|
-
mimeType: string;
|
|
23
|
-
};
|
|
24
|
-
export type McpContent = McpTextContent | McpImageContent;
|
|
25
|
-
export type McpToolHandlerResult = {
|
|
26
|
-
content: McpContent[];
|
|
27
|
-
data?: unknown;
|
|
28
|
-
structuredContent?: Record<string, unknown>;
|
|
29
|
-
isError?: true;
|
|
30
|
-
};
|
|
31
|
-
export type ToolCallEvent = {
|
|
32
|
-
name: string;
|
|
33
|
-
args: Record<string, unknown>;
|
|
34
|
-
result: unknown;
|
|
35
|
-
};
|
|
36
|
-
export type McpToolLifecycleHooks = {
|
|
37
|
-
can?: (name: string, args: Record<string, unknown>, ctx?: AiContext) => boolean | Promise<boolean>;
|
|
38
|
-
before?: (name: string, args: Record<string, unknown>, ctx?: AiContext) => boolean | undefined | Promise<boolean> | Promise<undefined>;
|
|
39
|
-
after?: (name: string, args: Record<string, unknown>, result: McpToolHandlerResult, ctx?: AiContext) => void | Promise<void>;
|
|
40
|
-
onError?: (name: string, args: Record<string, unknown>, error: Error, ctx?: AiContext) => void | Promise<void>;
|
|
41
|
-
};
|
|
42
|
-
export type McpToolHandler<T extends Record<string, unknown> = any> = (args: T, ctx: AiContext) => Promise<McpToolHandlerResult> | McpToolHandlerResult;
|
|
43
|
-
export type McpTool = {
|
|
44
|
-
name: string;
|
|
45
|
-
mcpDefinition: {
|
|
46
|
-
title?: string;
|
|
47
|
-
description: string;
|
|
48
|
-
inputSchema?: ZodType<any, any, any>;
|
|
49
|
-
outputSchema?: ZodType<any, any, any>;
|
|
50
|
-
annotations?: ToolAnnotations;
|
|
51
|
-
};
|
|
52
|
-
definition: {
|
|
53
|
-
allowedModes: AiMode[];
|
|
54
|
-
};
|
|
55
|
-
handler?: McpToolHandler;
|
|
56
|
-
};
|
|
File without changes
|
|
File without changes
|