@dotzero.ai/export-mcp 1.2.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/README.md +474 -0
- package/dist/chart-engine.d.ts +29 -0
- package/dist/chart-engine.js +1 -0
- package/dist/colors.d.ts +21 -0
- package/dist/colors.js +1 -0
- package/dist/export-engine.d.ts +17 -0
- package/dist/export-engine.js +1 -0
- package/dist/file-output.d.ts +10 -0
- package/dist/file-output.js +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +2 -0
- package/dist/schemas.d.ts +126 -0
- package/dist/schemas.js +1 -0
- package/dist/tool-registry.d.ts +10 -0
- package/dist/tool-registry.js +1 -0
- package/dist/tools/charts/bar.d.ts +214 -0
- package/dist/tools/charts/bar.js +1 -0
- package/dist/tools/charts/control-chart.d.ts +109 -0
- package/dist/tools/charts/control-chart.js +1 -0
- package/dist/tools/charts/gauge.d.ts +120 -0
- package/dist/tools/charts/gauge.js +1 -0
- package/dist/tools/charts/index.d.ts +9 -0
- package/dist/tools/charts/index.js +1 -0
- package/dist/tools/charts/line.d.ts +226 -0
- package/dist/tools/charts/line.js +1 -0
- package/dist/tools/charts/multi.d.ts +466 -0
- package/dist/tools/charts/multi.js +1 -0
- package/dist/tools/charts/oee-breakdown.d.ts +156 -0
- package/dist/tools/charts/oee-breakdown.js +1 -0
- package/dist/tools/charts/pie.d.ts +90 -0
- package/dist/tools/charts/pie.js +1 -0
- package/dist/tools/charts/scatter.d.ts +250 -0
- package/dist/tools/charts/scatter.js +1 -0
- package/dist/tools/charts/timeline.d.ts +128 -0
- package/dist/tools/charts/timeline.js +1 -0
- package/dist/tools/exports/csv.d.ts +51 -0
- package/dist/tools/exports/csv.js +1 -0
- package/dist/tools/exports/index.d.ts +2 -0
- package/dist/tools/exports/index.js +1 -0
- package/dist/tools/exports/xlsx.d.ts +85 -0
- package/dist/tools/exports/xlsx.js +1 -0
- package/dist/tools/smart/chart-from-json.d.ts +84 -0
- package/dist/tools/smart/chart-from-json.js +1 -0
- package/dist/tools/smart/index.d.ts +2 -0
- package/dist/tools/smart/index.js +1 -0
- package/dist/tools/smart/table-from-json.d.ts +63 -0
- package/dist/tools/smart/table-from-json.js +1 -0
- package/dist/types.d.ts +75 -0
- package/dist/types.js +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ChartOeeBreakdownSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodDefault<z.ZodString>;
|
|
4
|
+
availability: z.ZodNumber;
|
|
5
|
+
quality: z.ZodNumber;
|
|
6
|
+
performance: z.ZodNumber;
|
|
7
|
+
oee: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
devices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
availability: z.ZodNumber;
|
|
11
|
+
quality: z.ZodNumber;
|
|
12
|
+
performance: z.ZodNumber;
|
|
13
|
+
oee: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
name: string;
|
|
16
|
+
availability: number;
|
|
17
|
+
quality: number;
|
|
18
|
+
performance: number;
|
|
19
|
+
oee?: number | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
name: string;
|
|
22
|
+
availability: number;
|
|
23
|
+
quality: number;
|
|
24
|
+
performance: number;
|
|
25
|
+
oee?: number | undefined;
|
|
26
|
+
}>, "many">>;
|
|
27
|
+
} & {
|
|
28
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
29
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
30
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
31
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
32
|
+
}, "strict", z.ZodTypeAny, {
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
format: "png" | "jpg";
|
|
36
|
+
title: string;
|
|
37
|
+
availability: number;
|
|
38
|
+
quality: number;
|
|
39
|
+
performance: number;
|
|
40
|
+
output_path?: string | undefined;
|
|
41
|
+
oee?: number | undefined;
|
|
42
|
+
devices?: {
|
|
43
|
+
name: string;
|
|
44
|
+
availability: number;
|
|
45
|
+
quality: number;
|
|
46
|
+
performance: number;
|
|
47
|
+
oee?: number | undefined;
|
|
48
|
+
}[] | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
availability: number;
|
|
51
|
+
quality: number;
|
|
52
|
+
performance: number;
|
|
53
|
+
width?: number | undefined;
|
|
54
|
+
height?: number | undefined;
|
|
55
|
+
output_path?: string | undefined;
|
|
56
|
+
format?: "png" | "jpg" | undefined;
|
|
57
|
+
title?: string | undefined;
|
|
58
|
+
oee?: number | undefined;
|
|
59
|
+
devices?: {
|
|
60
|
+
name: string;
|
|
61
|
+
availability: number;
|
|
62
|
+
quality: number;
|
|
63
|
+
performance: number;
|
|
64
|
+
oee?: number | undefined;
|
|
65
|
+
}[] | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
export type ChartOeeBreakdownInput = z.infer<typeof ChartOeeBreakdownSchema>;
|
|
68
|
+
export declare const chartOeeBreakdownTool: {
|
|
69
|
+
name: string;
|
|
70
|
+
title: string;
|
|
71
|
+
description: string;
|
|
72
|
+
inputSchema: z.ZodObject<{
|
|
73
|
+
title: z.ZodDefault<z.ZodString>;
|
|
74
|
+
availability: z.ZodNumber;
|
|
75
|
+
quality: z.ZodNumber;
|
|
76
|
+
performance: z.ZodNumber;
|
|
77
|
+
oee: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
devices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
availability: z.ZodNumber;
|
|
81
|
+
quality: z.ZodNumber;
|
|
82
|
+
performance: z.ZodNumber;
|
|
83
|
+
oee: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
name: string;
|
|
86
|
+
availability: number;
|
|
87
|
+
quality: number;
|
|
88
|
+
performance: number;
|
|
89
|
+
oee?: number | undefined;
|
|
90
|
+
}, {
|
|
91
|
+
name: string;
|
|
92
|
+
availability: number;
|
|
93
|
+
quality: number;
|
|
94
|
+
performance: number;
|
|
95
|
+
oee?: number | undefined;
|
|
96
|
+
}>, "many">>;
|
|
97
|
+
} & {
|
|
98
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
99
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
100
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
101
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
102
|
+
}, "strict", z.ZodTypeAny, {
|
|
103
|
+
width: number;
|
|
104
|
+
height: number;
|
|
105
|
+
format: "png" | "jpg";
|
|
106
|
+
title: string;
|
|
107
|
+
availability: number;
|
|
108
|
+
quality: number;
|
|
109
|
+
performance: number;
|
|
110
|
+
output_path?: string | undefined;
|
|
111
|
+
oee?: number | undefined;
|
|
112
|
+
devices?: {
|
|
113
|
+
name: string;
|
|
114
|
+
availability: number;
|
|
115
|
+
quality: number;
|
|
116
|
+
performance: number;
|
|
117
|
+
oee?: number | undefined;
|
|
118
|
+
}[] | undefined;
|
|
119
|
+
}, {
|
|
120
|
+
availability: number;
|
|
121
|
+
quality: number;
|
|
122
|
+
performance: number;
|
|
123
|
+
width?: number | undefined;
|
|
124
|
+
height?: number | undefined;
|
|
125
|
+
output_path?: string | undefined;
|
|
126
|
+
format?: "png" | "jpg" | undefined;
|
|
127
|
+
title?: string | undefined;
|
|
128
|
+
oee?: number | undefined;
|
|
129
|
+
devices?: {
|
|
130
|
+
name: string;
|
|
131
|
+
availability: number;
|
|
132
|
+
quality: number;
|
|
133
|
+
performance: number;
|
|
134
|
+
oee?: number | undefined;
|
|
135
|
+
}[] | undefined;
|
|
136
|
+
}>;
|
|
137
|
+
annotations: {
|
|
138
|
+
readOnlyHint: boolean;
|
|
139
|
+
destructiveHint: boolean;
|
|
140
|
+
idempotentHint: boolean;
|
|
141
|
+
openWorldHint: boolean;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
export declare function executeChartOeeBreakdown(params: ChartOeeBreakdownInput): Promise<{
|
|
145
|
+
content: ({
|
|
146
|
+
type: "text";
|
|
147
|
+
text: string;
|
|
148
|
+
data?: undefined;
|
|
149
|
+
mimeType?: undefined;
|
|
150
|
+
} | {
|
|
151
|
+
type: "image";
|
|
152
|
+
data: string;
|
|
153
|
+
mimeType: "image/png" | "image/jpeg";
|
|
154
|
+
text?: undefined;
|
|
155
|
+
})[];
|
|
156
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"zod";import{BaseChartParams}from"../../schemas.js";import{renderChart,chartResultToContent}from"../../chart-engine.js";import{DOTZERO_COLORS,withAlpha}from"../../colors.js";export const ChartOeeBreakdownSchema=z.object({title:z.string().default("OEE Breakdown").describe("Chart title"),availability:z.number().describe("Availability rate (0-100)"),quality:z.number().describe("Quality rate (0-100)"),performance:z.number().describe("Performance rate (0-100)"),oee:z.number().optional().describe("Combined OEE (auto-calculated if omitted)"),devices:z.array(z.object({name:z.string(),availability:z.number(),quality:z.number(),performance:z.number(),oee:z.number().optional()})).optional().describe("Multi-device breakdown (renders grouped bar chart)")}).merge(BaseChartParams).strict();export const chartOeeBreakdownTool={name:"chart_oee_breakdown",title:"OEE Breakdown Chart",description:"Generate an OEE breakdown chart showing Availability, Quality, Performance, and combined OEE. Pass single values or an array of devices for comparison.",inputSchema:ChartOeeBreakdownSchema,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};export async function executeChartOeeBreakdown(e){let a;if(e.devices&&e.devices.length>0){a={type:"bar",data:{labels:e.devices.map(e=>e.name),datasets:[{label:"Availability",data:e.devices.map(e=>e.availability),backgroundColor:withAlpha(DOTZERO_COLORS.availability,.7),borderColor:DOTZERO_COLORS.availability,borderWidth:1},{label:"Quality",data:e.devices.map(e=>e.quality),backgroundColor:withAlpha(DOTZERO_COLORS.quality,.7),borderColor:DOTZERO_COLORS.quality,borderWidth:1},{label:"Performance",data:e.devices.map(e=>e.performance),backgroundColor:withAlpha(DOTZERO_COLORS.performance,.7),borderColor:DOTZERO_COLORS.performance,borderWidth:1},{label:"OEE",data:e.devices.map(e=>e.oee??e.availability*e.quality*e.performance/1e4),backgroundColor:withAlpha(DOTZERO_COLORS.oee,.7),borderColor:DOTZERO_COLORS.oee,borderWidth:1}]},options:{responsive:!1,plugins:{title:{display:!0,text:e.title,font:{size:16}},legend:{display:!0}},scales:{y:{min:0,max:100,title:{display:!0,text:"%"}}}}}}else{const t=e.oee??e.availability*e.quality*e.performance/1e4,r=["Availability","Quality","Performance","OEE"],i=[e.availability,e.quality,e.performance,t],o=[DOTZERO_COLORS.availability,DOTZERO_COLORS.quality,DOTZERO_COLORS.performance,DOTZERO_COLORS.oee];a={type:"bar",data:{labels:r,datasets:[{label:"Value (%)",data:i,backgroundColor:o.map(e=>withAlpha(e,.7)),borderColor:o,borderWidth:2}]},options:{responsive:!1,plugins:{title:{display:!0,text:e.title,font:{size:16}},legend:{display:!1}},scales:{y:{min:0,max:100,title:{display:!0,text:"%"}}}}}}const t=await renderChart(a,{width:e.width,height:e.height,format:e.format,outputPath:e.output_path,title:e.title});return chartResultToContent(t)}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ChartPieSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodString;
|
|
4
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
5
|
+
values: z.ZodArray<z.ZodNumber, "many">;
|
|
6
|
+
colors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
+
chart_type: z.ZodDefault<z.ZodEnum<["pie", "doughnut"]>>;
|
|
8
|
+
} & {
|
|
9
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
10
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
12
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
values: number[];
|
|
17
|
+
format: "png" | "jpg";
|
|
18
|
+
title: string;
|
|
19
|
+
labels: string[];
|
|
20
|
+
chart_type: "pie" | "doughnut";
|
|
21
|
+
output_path?: string | undefined;
|
|
22
|
+
colors?: string[] | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
values: number[];
|
|
25
|
+
title: string;
|
|
26
|
+
labels: string[];
|
|
27
|
+
width?: number | undefined;
|
|
28
|
+
height?: number | undefined;
|
|
29
|
+
output_path?: string | undefined;
|
|
30
|
+
format?: "png" | "jpg" | undefined;
|
|
31
|
+
colors?: string[] | undefined;
|
|
32
|
+
chart_type?: "pie" | "doughnut" | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
export type ChartPieInput = z.infer<typeof ChartPieSchema>;
|
|
35
|
+
export declare const chartPieTool: {
|
|
36
|
+
name: string;
|
|
37
|
+
title: string;
|
|
38
|
+
description: string;
|
|
39
|
+
inputSchema: z.ZodObject<{
|
|
40
|
+
title: z.ZodString;
|
|
41
|
+
labels: z.ZodArray<z.ZodString, "many">;
|
|
42
|
+
values: z.ZodArray<z.ZodNumber, "many">;
|
|
43
|
+
colors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
44
|
+
chart_type: z.ZodDefault<z.ZodEnum<["pie", "doughnut"]>>;
|
|
45
|
+
} & {
|
|
46
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
47
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
48
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
49
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
50
|
+
}, "strict", z.ZodTypeAny, {
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
values: number[];
|
|
54
|
+
format: "png" | "jpg";
|
|
55
|
+
title: string;
|
|
56
|
+
labels: string[];
|
|
57
|
+
chart_type: "pie" | "doughnut";
|
|
58
|
+
output_path?: string | undefined;
|
|
59
|
+
colors?: string[] | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
values: number[];
|
|
62
|
+
title: string;
|
|
63
|
+
labels: string[];
|
|
64
|
+
width?: number | undefined;
|
|
65
|
+
height?: number | undefined;
|
|
66
|
+
output_path?: string | undefined;
|
|
67
|
+
format?: "png" | "jpg" | undefined;
|
|
68
|
+
colors?: string[] | undefined;
|
|
69
|
+
chart_type?: "pie" | "doughnut" | undefined;
|
|
70
|
+
}>;
|
|
71
|
+
annotations: {
|
|
72
|
+
readOnlyHint: boolean;
|
|
73
|
+
destructiveHint: boolean;
|
|
74
|
+
idempotentHint: boolean;
|
|
75
|
+
openWorldHint: boolean;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export declare function executeChartPie(params: ChartPieInput): Promise<{
|
|
79
|
+
content: ({
|
|
80
|
+
type: "text";
|
|
81
|
+
text: string;
|
|
82
|
+
data?: undefined;
|
|
83
|
+
mimeType?: undefined;
|
|
84
|
+
} | {
|
|
85
|
+
type: "image";
|
|
86
|
+
data: string;
|
|
87
|
+
mimeType: "image/png" | "image/jpeg";
|
|
88
|
+
text?: undefined;
|
|
89
|
+
})[];
|
|
90
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"zod";import{BaseChartParams}from"../../schemas.js";import{renderChart,chartResultToContent}from"../../chart-engine.js";import{getSeriesColor,withAlpha}from"../../colors.js";export const ChartPieSchema=z.object({title:z.string().describe("Chart title"),labels:z.array(z.string()).describe("Slice labels"),values:z.array(z.number()).describe("Slice values"),colors:z.array(z.string()).optional().describe("Slice colors (hex). Auto-assigned if omitted."),chart_type:z.enum(["pie","doughnut"]).default("pie").describe("Pie or doughnut style")}).merge(BaseChartParams).strict();export const chartPieTool={name:"chart_pie",title:"Pie Chart",description:"Generate a pie or doughnut chart. Provide labels and corresponding values.",inputSchema:ChartPieSchema,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};export async function executeChartPie(e){const t=e.labels.map((t,r)=>withAlpha(e.colors?.[r]||getSeriesColor(r),.8)),r=e.labels.map((t,r)=>e.colors?.[r]||getSeriesColor(r)),a={type:e.chart_type,data:{labels:e.labels,datasets:[{data:e.values,backgroundColor:t,borderColor:r,borderWidth:2}]},options:{responsive:!1,plugins:{title:{display:!0,text:e.title,font:{size:16}},legend:{display:!0,position:"right"}}}},o=await renderChart(a,{width:e.width,height:e.height,format:e.format,outputPath:e.output_path,title:e.title});return chartResultToContent(o)}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ChartScatterSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodString;
|
|
4
|
+
datasets: z.ZodArray<z.ZodObject<{
|
|
5
|
+
label: z.ZodString;
|
|
6
|
+
data: z.ZodArray<z.ZodObject<{
|
|
7
|
+
x: z.ZodNumber;
|
|
8
|
+
y: z.ZodNumber;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}, {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
}>, "many">;
|
|
16
|
+
color: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, "strict", z.ZodTypeAny, {
|
|
18
|
+
label: string;
|
|
19
|
+
data: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}[];
|
|
23
|
+
color?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
label: string;
|
|
26
|
+
data: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
}[];
|
|
30
|
+
color?: string | undefined;
|
|
31
|
+
}>, "many">;
|
|
32
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
stacked: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
horizontal: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
show_legend: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
show_grid: z.ZodOptional<z.ZodBoolean>;
|
|
37
|
+
x_label: z.ZodOptional<z.ZodString>;
|
|
38
|
+
y_label: z.ZodOptional<z.ZodString>;
|
|
39
|
+
min_y: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
max_y: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
stacked?: boolean | undefined;
|
|
43
|
+
horizontal?: boolean | undefined;
|
|
44
|
+
show_legend?: boolean | undefined;
|
|
45
|
+
show_grid?: boolean | undefined;
|
|
46
|
+
x_label?: string | undefined;
|
|
47
|
+
y_label?: string | undefined;
|
|
48
|
+
min_y?: number | undefined;
|
|
49
|
+
max_y?: number | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
stacked?: boolean | undefined;
|
|
52
|
+
horizontal?: boolean | undefined;
|
|
53
|
+
show_legend?: boolean | undefined;
|
|
54
|
+
show_grid?: boolean | undefined;
|
|
55
|
+
x_label?: string | undefined;
|
|
56
|
+
y_label?: string | undefined;
|
|
57
|
+
min_y?: number | undefined;
|
|
58
|
+
max_y?: number | undefined;
|
|
59
|
+
}>>;
|
|
60
|
+
} & {
|
|
61
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
62
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
63
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
64
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
65
|
+
}, "strict", z.ZodTypeAny, {
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
format: "png" | "jpg";
|
|
69
|
+
title: string;
|
|
70
|
+
datasets: {
|
|
71
|
+
label: string;
|
|
72
|
+
data: {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
}[];
|
|
76
|
+
color?: string | undefined;
|
|
77
|
+
}[];
|
|
78
|
+
options?: {
|
|
79
|
+
stacked?: boolean | undefined;
|
|
80
|
+
horizontal?: boolean | undefined;
|
|
81
|
+
show_legend?: boolean | undefined;
|
|
82
|
+
show_grid?: boolean | undefined;
|
|
83
|
+
x_label?: string | undefined;
|
|
84
|
+
y_label?: string | undefined;
|
|
85
|
+
min_y?: number | undefined;
|
|
86
|
+
max_y?: number | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
output_path?: string | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
title: string;
|
|
91
|
+
datasets: {
|
|
92
|
+
label: string;
|
|
93
|
+
data: {
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
}[];
|
|
97
|
+
color?: string | undefined;
|
|
98
|
+
}[];
|
|
99
|
+
width?: number | undefined;
|
|
100
|
+
height?: number | undefined;
|
|
101
|
+
options?: {
|
|
102
|
+
stacked?: boolean | undefined;
|
|
103
|
+
horizontal?: boolean | undefined;
|
|
104
|
+
show_legend?: boolean | undefined;
|
|
105
|
+
show_grid?: boolean | undefined;
|
|
106
|
+
x_label?: string | undefined;
|
|
107
|
+
y_label?: string | undefined;
|
|
108
|
+
min_y?: number | undefined;
|
|
109
|
+
max_y?: number | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
output_path?: string | undefined;
|
|
112
|
+
format?: "png" | "jpg" | undefined;
|
|
113
|
+
}>;
|
|
114
|
+
export type ChartScatterInput = z.infer<typeof ChartScatterSchema>;
|
|
115
|
+
export declare const chartScatterTool: {
|
|
116
|
+
name: string;
|
|
117
|
+
title: string;
|
|
118
|
+
description: string;
|
|
119
|
+
inputSchema: z.ZodObject<{
|
|
120
|
+
title: z.ZodString;
|
|
121
|
+
datasets: z.ZodArray<z.ZodObject<{
|
|
122
|
+
label: z.ZodString;
|
|
123
|
+
data: z.ZodArray<z.ZodObject<{
|
|
124
|
+
x: z.ZodNumber;
|
|
125
|
+
y: z.ZodNumber;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
x: number;
|
|
128
|
+
y: number;
|
|
129
|
+
}, {
|
|
130
|
+
x: number;
|
|
131
|
+
y: number;
|
|
132
|
+
}>, "many">;
|
|
133
|
+
color: z.ZodOptional<z.ZodString>;
|
|
134
|
+
}, "strict", z.ZodTypeAny, {
|
|
135
|
+
label: string;
|
|
136
|
+
data: {
|
|
137
|
+
x: number;
|
|
138
|
+
y: number;
|
|
139
|
+
}[];
|
|
140
|
+
color?: string | undefined;
|
|
141
|
+
}, {
|
|
142
|
+
label: string;
|
|
143
|
+
data: {
|
|
144
|
+
x: number;
|
|
145
|
+
y: number;
|
|
146
|
+
}[];
|
|
147
|
+
color?: string | undefined;
|
|
148
|
+
}>, "many">;
|
|
149
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
stacked: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
horizontal: z.ZodOptional<z.ZodBoolean>;
|
|
152
|
+
show_legend: z.ZodOptional<z.ZodBoolean>;
|
|
153
|
+
show_grid: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
x_label: z.ZodOptional<z.ZodString>;
|
|
155
|
+
y_label: z.ZodOptional<z.ZodString>;
|
|
156
|
+
min_y: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
max_y: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
}, "strict", z.ZodTypeAny, {
|
|
159
|
+
stacked?: boolean | undefined;
|
|
160
|
+
horizontal?: boolean | undefined;
|
|
161
|
+
show_legend?: boolean | undefined;
|
|
162
|
+
show_grid?: boolean | undefined;
|
|
163
|
+
x_label?: string | undefined;
|
|
164
|
+
y_label?: string | undefined;
|
|
165
|
+
min_y?: number | undefined;
|
|
166
|
+
max_y?: number | undefined;
|
|
167
|
+
}, {
|
|
168
|
+
stacked?: boolean | undefined;
|
|
169
|
+
horizontal?: boolean | undefined;
|
|
170
|
+
show_legend?: boolean | undefined;
|
|
171
|
+
show_grid?: boolean | undefined;
|
|
172
|
+
x_label?: string | undefined;
|
|
173
|
+
y_label?: string | undefined;
|
|
174
|
+
min_y?: number | undefined;
|
|
175
|
+
max_y?: number | undefined;
|
|
176
|
+
}>>;
|
|
177
|
+
} & {
|
|
178
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
179
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
180
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
181
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
182
|
+
}, "strict", z.ZodTypeAny, {
|
|
183
|
+
width: number;
|
|
184
|
+
height: number;
|
|
185
|
+
format: "png" | "jpg";
|
|
186
|
+
title: string;
|
|
187
|
+
datasets: {
|
|
188
|
+
label: string;
|
|
189
|
+
data: {
|
|
190
|
+
x: number;
|
|
191
|
+
y: number;
|
|
192
|
+
}[];
|
|
193
|
+
color?: string | undefined;
|
|
194
|
+
}[];
|
|
195
|
+
options?: {
|
|
196
|
+
stacked?: boolean | undefined;
|
|
197
|
+
horizontal?: boolean | undefined;
|
|
198
|
+
show_legend?: boolean | undefined;
|
|
199
|
+
show_grid?: boolean | undefined;
|
|
200
|
+
x_label?: string | undefined;
|
|
201
|
+
y_label?: string | undefined;
|
|
202
|
+
min_y?: number | undefined;
|
|
203
|
+
max_y?: number | undefined;
|
|
204
|
+
} | undefined;
|
|
205
|
+
output_path?: string | undefined;
|
|
206
|
+
}, {
|
|
207
|
+
title: string;
|
|
208
|
+
datasets: {
|
|
209
|
+
label: string;
|
|
210
|
+
data: {
|
|
211
|
+
x: number;
|
|
212
|
+
y: number;
|
|
213
|
+
}[];
|
|
214
|
+
color?: string | undefined;
|
|
215
|
+
}[];
|
|
216
|
+
width?: number | undefined;
|
|
217
|
+
height?: number | undefined;
|
|
218
|
+
options?: {
|
|
219
|
+
stacked?: boolean | undefined;
|
|
220
|
+
horizontal?: boolean | undefined;
|
|
221
|
+
show_legend?: boolean | undefined;
|
|
222
|
+
show_grid?: boolean | undefined;
|
|
223
|
+
x_label?: string | undefined;
|
|
224
|
+
y_label?: string | undefined;
|
|
225
|
+
min_y?: number | undefined;
|
|
226
|
+
max_y?: number | undefined;
|
|
227
|
+
} | undefined;
|
|
228
|
+
output_path?: string | undefined;
|
|
229
|
+
format?: "png" | "jpg" | undefined;
|
|
230
|
+
}>;
|
|
231
|
+
annotations: {
|
|
232
|
+
readOnlyHint: boolean;
|
|
233
|
+
destructiveHint: boolean;
|
|
234
|
+
idempotentHint: boolean;
|
|
235
|
+
openWorldHint: boolean;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
export declare function executeChartScatter(params: ChartScatterInput): Promise<{
|
|
239
|
+
content: ({
|
|
240
|
+
type: "text";
|
|
241
|
+
text: string;
|
|
242
|
+
data?: undefined;
|
|
243
|
+
mimeType?: undefined;
|
|
244
|
+
} | {
|
|
245
|
+
type: "image";
|
|
246
|
+
data: string;
|
|
247
|
+
mimeType: "image/png" | "image/jpeg";
|
|
248
|
+
text?: undefined;
|
|
249
|
+
})[];
|
|
250
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"zod";import{ScatterDatasetSchema,ChartOptionsSchema,BaseChartParams}from"../../schemas.js";import{renderChart,chartResultToContent}from"../../chart-engine.js";import{getSeriesColor,withAlpha}from"../../colors.js";export const ChartScatterSchema=z.object({title:z.string().describe("Chart title"),datasets:z.array(ScatterDatasetSchema).describe("Scatter data series"),options:ChartOptionsSchema}).merge(BaseChartParams).strict();export const chartScatterTool={name:"chart_scatter",title:"Scatter Chart",description:"Generate a scatter plot with one or more datasets of {x, y} points.",inputSchema:ChartScatterSchema,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};export async function executeChartScatter(t){const e=t.options||{},a={type:"scatter",data:{datasets:t.datasets.map((t,e)=>{const a=t.color||getSeriesColor(e);return{label:t.label,data:t.data,backgroundColor:withAlpha(a,.6),borderColor:a,pointRadius:5}})},options:{responsive:!1,plugins:{title:{display:!0,text:t.title,font:{size:16}},legend:{display:!1!==e.show_legend}},scales:{x:{title:{display:!!e.x_label,text:e.x_label},grid:{display:!1!==e.show_grid},min:void 0,max:void 0},y:{title:{display:!!e.y_label,text:e.y_label},grid:{display:!1!==e.show_grid},min:e.min_y,max:e.max_y}}}},r=await renderChart(a,{width:t.width,height:t.height,format:t.format,outputPath:t.output_path,title:t.title});return chartResultToContent(r)}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ChartTimelineSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodDefault<z.ZodString>;
|
|
4
|
+
device_name: z.ZodOptional<z.ZodString>;
|
|
5
|
+
segments: z.ZodArray<z.ZodObject<{
|
|
6
|
+
start: z.ZodString;
|
|
7
|
+
end: z.ZodString;
|
|
8
|
+
state: z.ZodString;
|
|
9
|
+
color: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
start: string;
|
|
12
|
+
end: string;
|
|
13
|
+
state: string;
|
|
14
|
+
color?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
start: string;
|
|
17
|
+
end: string;
|
|
18
|
+
state: string;
|
|
19
|
+
color?: string | undefined;
|
|
20
|
+
}>, "many">;
|
|
21
|
+
} & {
|
|
22
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
23
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
24
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
25
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
format: "png" | "jpg";
|
|
30
|
+
title: string;
|
|
31
|
+
segments: {
|
|
32
|
+
start: string;
|
|
33
|
+
end: string;
|
|
34
|
+
state: string;
|
|
35
|
+
color?: string | undefined;
|
|
36
|
+
}[];
|
|
37
|
+
output_path?: string | undefined;
|
|
38
|
+
device_name?: string | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
segments: {
|
|
41
|
+
start: string;
|
|
42
|
+
end: string;
|
|
43
|
+
state: string;
|
|
44
|
+
color?: string | undefined;
|
|
45
|
+
}[];
|
|
46
|
+
width?: number | undefined;
|
|
47
|
+
height?: number | undefined;
|
|
48
|
+
output_path?: string | undefined;
|
|
49
|
+
format?: "png" | "jpg" | undefined;
|
|
50
|
+
title?: string | undefined;
|
|
51
|
+
device_name?: string | undefined;
|
|
52
|
+
}>;
|
|
53
|
+
export type ChartTimelineInput = z.infer<typeof ChartTimelineSchema>;
|
|
54
|
+
export declare const chartTimelineTool: {
|
|
55
|
+
name: string;
|
|
56
|
+
title: string;
|
|
57
|
+
description: string;
|
|
58
|
+
inputSchema: z.ZodObject<{
|
|
59
|
+
title: z.ZodDefault<z.ZodString>;
|
|
60
|
+
device_name: z.ZodOptional<z.ZodString>;
|
|
61
|
+
segments: z.ZodArray<z.ZodObject<{
|
|
62
|
+
start: z.ZodString;
|
|
63
|
+
end: z.ZodString;
|
|
64
|
+
state: z.ZodString;
|
|
65
|
+
color: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, "strict", z.ZodTypeAny, {
|
|
67
|
+
start: string;
|
|
68
|
+
end: string;
|
|
69
|
+
state: string;
|
|
70
|
+
color?: string | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
start: string;
|
|
73
|
+
end: string;
|
|
74
|
+
state: string;
|
|
75
|
+
color?: string | undefined;
|
|
76
|
+
}>, "many">;
|
|
77
|
+
} & {
|
|
78
|
+
output_path: z.ZodOptional<z.ZodString>;
|
|
79
|
+
width: z.ZodDefault<z.ZodNumber>;
|
|
80
|
+
height: z.ZodDefault<z.ZodNumber>;
|
|
81
|
+
format: z.ZodDefault<z.ZodEnum<["png", "jpg"]>>;
|
|
82
|
+
}, "strict", z.ZodTypeAny, {
|
|
83
|
+
width: number;
|
|
84
|
+
height: number;
|
|
85
|
+
format: "png" | "jpg";
|
|
86
|
+
title: string;
|
|
87
|
+
segments: {
|
|
88
|
+
start: string;
|
|
89
|
+
end: string;
|
|
90
|
+
state: string;
|
|
91
|
+
color?: string | undefined;
|
|
92
|
+
}[];
|
|
93
|
+
output_path?: string | undefined;
|
|
94
|
+
device_name?: string | undefined;
|
|
95
|
+
}, {
|
|
96
|
+
segments: {
|
|
97
|
+
start: string;
|
|
98
|
+
end: string;
|
|
99
|
+
state: string;
|
|
100
|
+
color?: string | undefined;
|
|
101
|
+
}[];
|
|
102
|
+
width?: number | undefined;
|
|
103
|
+
height?: number | undefined;
|
|
104
|
+
output_path?: string | undefined;
|
|
105
|
+
format?: "png" | "jpg" | undefined;
|
|
106
|
+
title?: string | undefined;
|
|
107
|
+
device_name?: string | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
annotations: {
|
|
110
|
+
readOnlyHint: boolean;
|
|
111
|
+
destructiveHint: boolean;
|
|
112
|
+
idempotentHint: boolean;
|
|
113
|
+
openWorldHint: boolean;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export declare function executeChartTimeline(params: ChartTimelineInput): Promise<{
|
|
117
|
+
content: ({
|
|
118
|
+
type: "text";
|
|
119
|
+
text: string;
|
|
120
|
+
data?: undefined;
|
|
121
|
+
mimeType?: undefined;
|
|
122
|
+
} | {
|
|
123
|
+
type: "image";
|
|
124
|
+
data: string;
|
|
125
|
+
mimeType: "image/png" | "image/jpeg";
|
|
126
|
+
text?: undefined;
|
|
127
|
+
})[];
|
|
128
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"zod";import{TimelineSegmentSchema,BaseChartParams}from"../../schemas.js";import{renderChart,chartResultToContent}from"../../chart-engine.js";import{DOTZERO_COLORS}from"../../colors.js";function stateColor(e){const t=e.toLowerCase();return"running"===t||"run"===t?DOTZERO_COLORS.running:"idle"===t?DOTZERO_COLORS.idle:"down"===t||"alarm"===t?DOTZERO_COLORS.down:"off"===t?DOTZERO_COLORS.off:"#9E9E9E"}export const ChartTimelineSchema=z.object({title:z.string().default("Device Timeline").describe("Chart title"),device_name:z.string().optional().describe("Device name for y-axis label"),segments:z.array(TimelineSegmentSchema).min(1).describe("Timeline segments")}).merge(BaseChartParams).strict();export const chartTimelineTool={name:"chart_timeline",title:"Device Timeline Chart",description:"Generate a horizontal timeline chart showing device states (running/idle/down/off) over time. Data source: equip_machine_status_history.",inputSchema:ChartTimelineSchema,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}};export async function executeChartTimeline(e){const{segments:t}=e,a=new Date(t[0].start).getTime(),i=[...new Set(t.map(e=>e.state))].map(e=>{const i=t.filter(t=>t.state===e);return{label:e,data:i.map(e=>[(new Date(e.start).getTime()-a)/6e4,(new Date(e.end).getTime()-a)/6e4]),backgroundColor:t.find(t=>t.state===e)?.color||stateColor(e),barPercentage:.8}}),n={type:"bar",data:{labels:[e.device_name||"Device"],datasets:i.map(e=>({label:e.label,data:e.data,backgroundColor:e.backgroundColor,barPercentage:e.barPercentage}))},options:{responsive:!1,indexAxis:"y",plugins:{title:{display:!0,text:e.title,font:{size:16}},legend:{display:!0,position:"bottom"}},scales:{x:{title:{display:!0,text:"Time (minutes from start)"},stacked:!1},y:{stacked:!0}}}},r=await renderChart(n,{width:e.width,height:Math.max(e.height,250),format:e.format,outputPath:e.output_path,title:e.title});return chartResultToContent(r)}
|